简体   繁体   English

Netbeans项目不会使用自定义Ant目标进行重建

[英]Netbeans project won't rebuild with custom Ant target

Building a project in Netbeans. 在Netbeans中构建一个项目。 I have a single custom ANT Target in build.xml that copies two library files to dist/lib before the program runs: 我在build.xml中有一个自定义ANT目标,可以在程序运行之前将两个库文件复制到dist / lib中:

<?xml version="1.0" encoding="UTF-8"?>
<project name="ApplicationName" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">

<description>Builds, tests, and runs the project EnrollmentApplication.</description>

<import file="nbproject/build-impl.xml"/>

    <target name="-post-jar">
        <echo message="Copying dll files..." />
        <copy file="lib/file1.dll" todir="${dist.dir}/lib" />
        <copy file="lib/file2.dll" todir="${dist.dir}/lib" />
    </target>

</project>

However, when I make code changes, build, and run, the code changes aren't reflected in the new run. 但是,当我进行代码更改,构建和运行时,代码更改不会反映在新运行中。 If I clean, rebuild, and run, I get Error: Unable to access jarfile <file path>\\Application1.jar 如果我清理,重建并运行, Error: Unable to access jarfile <file path>\\Application1.jar收到Error: Unable to access jarfile <file path>\\Application1.jar

Modifying build.xml manually at this point lets the project rebuild correctly once , and then the cycle starts over again. 此时,手动修改build.xml可使项目一次正确地重建,然后循环重新开始。 What am I misunderstanding about this Ant Target? 我对这个蚂蚁目标有什么误解? It seems extremely straightforward. 似乎非常简单。

EDIT: 编辑:

Apparently copying files has nothing to do with it. 显然,复制文件与此无关。 Even overriding -post-jar with just the <echo> task yields the same problems 即使仅使用<echo>任务覆盖-post-jar也会产生相同的问题

After looking at nbproject/build-impl.xml, it was apparent that the -post-jar target had dependencies that I was not including in my overriding target. 在查看nbproject / build-impl.xml之后,很明显-post-jar目标具有我不包含在覆盖目标中的依赖项。 They are listed below (note that this is a JavaFX program). 它们在下面列出(请注意,这是一个JavaFX程序)。

<target depends="-jfx-copylibs,-rebase-libs,jfx-deployment" name="-post-jar">

I assume these other targets are only called because -post-jar lists them as dependencies, ie they are not called by any other target. 我假设只调用这些其他目标,因为-post-jar将它们列为依赖项,即,其他任何目标都未调用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM