java - Apache Ant {Compile javac srcdir} does not exist -
i new apache ant , working on apache ant project. started out, imported project workspace , tried run build.xml. added libraries come original project build path. having following problem. please else wrote code , supposed improve it. directories exist in project directory.
build failed c:\workspace\myapp\build.xml:83: srcdir "c:\workspace\myapp\${compile.javac.srcdir}" not exist! the error code referencing following part of build.xml file
<target name="compile.default" depends="init"> <javac fork="yes" srcdir="${compile.javac.srcdir}" destdir="${compile.javac.destdir}" includes="${compile.javac.include}" excludes="${compile.javac.exclude}" classpath="${compile.javac.classpath}" debug="${compile.javac.debug}" optimize="${compile.javac.optimize}" deprecation="${compile.javac.deprecation}" verbose="${compile.javac.verbose}"> </javac> <copy todir="${compile.javac.destdir}"> <fileset dir="${compile.javac.srcdir}" includes="${compile.copy.include}" excludes="${compile.copy.exclude}"/> </copy> </target> <target name="compile" depends="init,compile.default" description="compile java source"> </target> <!--+++++++++++++++--> <!-- lib target(s) --> <!--+++++++++++++++--> <target name="lib.default" depends="init,compile"> <xmlbean schema="config/schemas/validate/1.0/validate.xsd" destfile="lib/glx-beans.jar" classpath="lib/xbean.jar:lib/jsr173_1.0_api.jar" /> <jar jarfile="${lib.filename}"> <fileset dir="${lib.srcdir}" excludes="${lib.exclude}" /> </jar> </target> <target name="lib" depends="init,compile,lib.default" description="create project libraries"> </target> would please tell me missing?
the ${compile.javac.srcdir} isn't defined. there few possibilities:
- this defined not in
build.xml, in sort of properties file. see if have<property file="..."/>in build script. recommendation have properties defined inbuild.xmlfile, , use properties file override settings. way, build file developer needs inbuild.xmlfile , doesn't have worry setting separatebuild.porpertiesfile. - this defined in
build.xmlfile under particular task, forgot target use thisis dependent upon task.
one of things can use -d parameter when running ant. run following command when running ant -d parameter:
$ , -d 2>&1 | tee ant.out i can @ ant.out , see if somehow didn't define particular property. maybe had wrong capitalization or misspelled property name. example, it's i'll define property copmile.javac.srcdir because don't know how spell. looking @ -d output can point these types of errors out.
by way, shouldn't have of tasks dependent upon init since they're dependent upon compile.default anyway:
<target name="compile.default" depends="init"> .... </target> <target name="compile" depends="compile.default"> .... </target> <target name="lib" depends="compile,lib.default"> .... </target> if run target lib, see compile dependent upon compile.default dependent upon init. thus, build run init, compile.default, compile, 'lib.defaultand finallylib`.
if init task setting properties, can outside of task. then, these properties setup before task executed. way, they're not forgotten. if init creating directories, may want move <mkdir/> tasks in front of task directory used. example, may want make destdir uses in javac before <javac/> task.
i find assigning default properties outside of task, , creating directories before needed simplify build.xml. plus, you're not creating whole flock of unused directories if user merely compiling , not packaging jar/war/etc.
Comments
Post a Comment