Unable to create NetBeans / Ant project

I inherited a project originally written in NetBeans, using Ant to build. I am an Eclipse user and have used Ant, but do not fully understand the specific way in which NetBeans Ant is used. I know that it uses the build-impl.xml file (imported into the build.xml file), but I do not understand how this file is created / updated using the IDE.

I have made some minor changes to a couple of classes and want to create a jar. I tried to run the "clean" and "jar" targets in Eclipse from build.xml and build-impl.xml, but get the following errors:

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. 

Line 661 is the j2seproject3 element for this purpose:

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

Line 337 is the javac line from this target:

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

I have no idea what these two goals are about and why they fail. I downloaded NetBeans7, hoping that its construction will be successful, but will get the same errors.

Is it safe to remove these objects from my assembly? Do I need to update the project.properties file?

Any help received for assembly is appreciated.

+4
source share
1 answer

Any other bugs? What message appeared after that? Was it a bunch of Java compilation errors, or was the <javac> task not running?

<macrodef> defines a new macro called <javac> that will run instead of the original <javac> . β€œWait a second!”, You say, is there no <javac> task already?

Yes there is, and it looks like he is redefining it. I usually thought it was bad work - especially since it does not accept the same <javac> arguments. Why not name it <netbeansc> or something else?

The @ signs are a kind of property. These are the parameters that you pass to the macro.

You have the following:

 <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> 

This invokes a macro that pretty much runs the ORIGINAL <javac> task to compile. I would make sure that all the properties shown below are defined.

 <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${build.classes.dir}" encoding="${source.encoding}" excludes="${excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="${includes}" source="${javac.source}" sourcepath="${empty.dir}" srcdir="${srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <src> <dirset dir="${empty.dir}" erroronmissingdir="false"> <include name="*"/> </dirset> </src> <classpath> <path path="${javac.classpath"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> 

+2
source

All Articles