Ant – How to print classpath from path id
In Ant, you can use pathconvert
task to print out the classpath from path :
build.xml
<path id="project.web.classpath">
<pathelement location="test/lib/junit-4.11.jar"/>
<pathelement location="test/lib/hamcrest-core-1.3.jar"/>
<fileset dir="${lib.web.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="print-classpath">
<pathconvert property="classpathInName" refid="project.web.classpath" />
<echo>Classpath is ${classpathInName}</echo>
</target>
Test :
$ ant print-classpath
Buildfile: /Users/mkyong/Documents/workspace/AntSpringMVC/build.xml
print-classpath:
[echo] Classpath is
/Users/mkyong/Documents/workspace/AntSpringMVC/test/lib/junit-4.11.jar:
/Users/mkyong/Documents/workspace/AntSpringMVC/testlib/hamcrest-core-1.3.jar:
......
BUILD SUCCESSFUL
Total time: 0 seconds
References
About Author
Comments
Subscribe
0 Comments