Ant – パスIDからクラスパスを出力する方法
Antでは、 `pathconvert`タスクを使ってパスからクラスパスを出力することができます:
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>
テスト:
$ 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:
......
成功する
合計時間:0秒
===参考文献