|
What appears below are my personal notes I wish were part of my long-term memory but don't always seem to fit. I strive for accuracy and clarity and appreciate feedback. If applying any of this information anywhere, confirm for youself the correctness of your work as what you see below might very well be, albeit unintentionally, incorrect or misleading. These notes are here as an easy reference for myself.
Information worthy of a more formal presentation will appear elsewhere than this "Scratch" area. - ksb
"Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles."
Ant of course has wrinkles of it's own, but those apparently are better wrinkles than Make's. As a developer, I'm not too happy about needing to learn the idiosyncrasies of yet another build tool. Oh well, when in Rome...
<project default="usage"> <description>Sample Ant build.xml file</description> <target name="usage" description="Display main targets by running 'ant -projecthelp'"> <java classname="org.apache.tools.ant.Main"> <arg value="-projecthelp" /> </java> </target> <!-- other targets --> </project>
<target name="compile" depends="init" description="Compile all java files"> <javac srcdir="." includes="*.java" destdir="." includeAntRuntime="no" fork="yes" debug="on"> <classpath refid="ccp" /> </javac> </target>
<target name="init"> <tstamp/> <property name="Base" value="/path/to/base"/> <path id="ccp" description="The CLASSPATH for compiling and running"> <pathelement location="${Base}/build/xmlsec.jar" /> <pathelement location="${Base}/libs/xalan.jar" /> <pathelement location="${Base}/libs/jakarta-log4j-1.2.6.jar" /> <pathelement location="." /> </path> </target>
<target name="parse" depends="compile" description="Parse the given XML file [parseme.xml]"> <property name="pFile" value="parseme.xml"/> <java classname="parse" fork="yes" taskname="parse"> <classpath refid="ccp" /> <arg value="${pFile}"/> </java> </target>That property line is there so that the pFile variable has a resonable default value if it is not defined on the ant command line. It appears that Ant doesn't recognize that ${pFile} is intended to be a variable, and if not defined it's value becomes it's name, literally: ${pFile} (I hope I've missed something, because this is pretty annoying.)