tags:

views:

78

answers:

1

I am new to ant, but am trying to create an ant script that builds my current proeject with another project as a dependency. I have the ant script building my current project, but am unsure how to add the other project to the classpath. Neither project get put into jar files at the moment.

My current portion of the build.xml file is

<target name="run" depends="compile">
<java classname="com.mypackage.Main">
  <classpath>
   <pathelement location="../project1/out"/>
   <pathelement location="${bin}"/>
  </classpath>
 </java>
</target>

Thanks for your help!

+1  A: 

I was able to do it using

<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>

Where ${other.dir} is the relative path to the root of the other project.

Casey