我是ant的新手,但我正在尝试创建一个ant脚本,用另一个项目作为依赖项构建我当前的项目。我有构建我当前项目的ant脚本,但我不确定如何将其他项目添加到类路径中。目前这两个项目都没有放入jar文件中。
我的build.xml文件的当前部分是
<target name="run" depends="compile">
<java classname="com.mypackage.Main">
<classpath>
<pathelement location="../project1/out"/>
<pathelement location="${bin}"/>
</classpath>
</java>
</target>
感谢您的帮助!
答案 0 :(得分:2)
我能够使用
完成<target name="run" depends="compile">
<java classname="com.mypackage.Main" fork="true">
<classpath>
<dirset dir="${other.dir}">
<include name="out/**"/>
</dirset>
<pathelement location="${bin}" />
</classpath>
</java>
</target>
其中$ {other.dir}是另一个项目根目录的相对路径。