我在 Netbeans 中有一个 java 项目,它构建得很好,并将 myproject.jar
文件放置到 dist 目录中。那很好。
我决定在构建完成后自动将 myproject.jar
复制到另一个目录。我通过放置行编辑了 build.xml
<target name="-post-compile">
<copy file="dist/myproject.jar" tofile="c:/anotherLocation/myproject.jar"/>
</target>
现在我有警告:
Warning: Could not find file C:\projectLocation\dist\myproject.jar to copy.
BUILD FAILED (total time: 0 seconds)
并且在我删除了 build.xml
中的新行之前,不会创建 dist
目录。
如何同时拥有这两种功能 - 构建和复制?
最佳答案
我猜你正在寻找
<target name="-post-jar">`
如果您检查 build.xml
中的注释部分,您可以看到:
-post-compile: called after javac compilation <-- .class files created
-post-jar: called after JAR building <-- .jar file created
在-post-jar
之前,还没有.jar
文件,因此会发出警告。
关于java - 在 Netbeans 中构建 xml 和 build-impl.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32254260/