gpt4 book ai didi

具有依赖项的项目的 java ant 构建文件

转载 作者:行者123 更新时间:2023-11-30 05:15:04 26 4
gpt4 key购买 nike

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

感谢您的帮助!

最佳答案

我能够使用它来做到这一点

<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} 是其他项目根目录的相对路径。

关于具有依赖项的项目的 java ant 构建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1739591/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com