java - Task dependency order in Ant -
i trying learn ant , found example build file in docs.
<project name="myproject" default="dist" basedir="."> <description> simple example build file </description> <!-- set global properties build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <!-- create time stamp --> <tstamp/> <!-- create build directory structure used compile --> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="compile source"> <!-- compile java code ${src} ${build} --> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile" description="generate distribution"> <!-- create distribution directory --> <mkdir dir="${dist}/lib"/> <!-- put in ${build} myproject-${dstamp}.jar file --> <jar jarfile="${dist}/lib/myproject-${dstamp}.jar" basedir="${build}"/> </target> <target name="clean" description="clean up"> <!-- delete ${build} , ${dist} directory trees --> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
i'm assuming clean
step should run before init
step neither step depends on other. should init
depend on clean
step? if not, how ant know proper order?
when ant build file runs, clean target not executed. isn't in dependency chain. have explicitly trigger form command line, e.g.
ant -f _buildfile.xml clean ant -f _buildfile.xml
i've done within bash file. example file, though, isn't how final build system work.
maybe doing dist should clean first (seems reasonable), should part of dist dependencies, not init target. instance, might want compile , not clean. so
<target name="dist" depends="clean, compile"...
or add new target, clean_dist, instance , add dependency there. quick distribution build , real distribution build specifying target on command line.
Comments
Post a Comment