我继承了一个使用Ant构建的NetBeans项目。我是Eclipse用户,虽然也用过Ant,但不完全理解NetBeans中使用Ant的特定方式。我知道它使用一个build-impl.xml
文件(导入到build.xml
中),但不知道IDE如何生成/更新
该文件。
我对几个类进行了一些小的更改,并希望构建一个jar包。我尝试从build.xml
和build-impl.xml
中在Eclipse中运行"clean"
和"jar"
目标,但出现以下错误:
BUILD FAILED
C:\Devel\Projects\MyProject\nbproject\build-impl.xml:661: The following error occurred while executing this line:
C:\Devel\Projects\MyProject\nbproject\build-impl.xml:337: Compile failed; see the compiler error output for details.
这个目标中的 j2seproject3 元素位于第 661 行:
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
这个目标的javac行是第337行:
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="sourcepath"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
我不知道这两个目标是什么,也不知道它们为什么会失败。我下载了 NetBeans7,希望在那里构建它会成功,但是出现了相同的错误。
我可以安全地从我的构建中删除这些目标吗?我需要更新 project.properties 文件吗?
任何帮助使其构建成功都将不胜感激。