开发者

java ant buildfile for project with dependencies

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">
<ja开发者_StackOverflow社区va classname="com.mypackage.Main">
        <classpath>
            <pathelement location="../project1/out"/>
            <pathelement location="${bin}"/>
        </classpath>
    </java>
</target>

Thanks for your help!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜