xml - ANT | Trying to override old definition of task javac Error -
i trying build jar in ant.below code generating jar file.i dont know why error("trying override old definition of task javac") happens.sometimes not generating jar.
<?xml version="1.0" ?> <project name="helloworld" default="compress"> <presetdef name="javac"> <javac includeantruntime="false" /> </presetdef> <target name="init"> <mkdir dir="build/classes" /> <mkdir dir="dist" /> </target> <target name="compile" depends="init"> <javac srcdir="src" destdir="build/classes"/> </target> <target name="compress" depends="compile"> <jar destfile="dist/sample.jar" basedir="build/classes" /> </target> <target name="execute" depends="compile"> <java classname="src" classpath="build/classes" /> </target> <target name="clean"> </target> </project>
the output follows:
buildfile: e:\gad project\project\gad\build.xml trying override old definition of task javac init: [mkdir] created dir: e:\gad project\project\gad\dist compile: compress: [jar] building jar: e:\gad project\project\gad\dist\sample.jar build successful total time: 1 second
let me know how can rectify error msg.?
lets try this
<presetdef name="my.javac"> <javac includeantruntime="false" /> </presetdef> <target name="compile" depends="init"> <my.javac srcdir="src" destdir="build/classes"/> </target>
Comments
Post a Comment