I’m trying to learn some ant for a Struts 1.x project that I was thrown onto. Mainly I’m trying to find a good referent for the inherent variables/properties of ant…beginners tutorial. Any GOOD reference really.
A couple lines of the ant file that I’ve been trying to figure out just for example…
<available file=${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
and
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue<![CDATA[<!-- <!DOCTYPE]]></replacevalue> //in ant is <!-- the comment out flag?
</replace>
I did do some searching and only could find ant build examples without explanation, but if it is covered and I just didn’t find it a link will suffice. No reason to make someone reexplain it….I just couldn’t find it.
Your first code block refers to the “available” ant task. It sets the property sun.web.present if the given file exists.
In your second code block, “<!–” starts an XML comment (“–>” closes one). This is true for all XML, not just ant build.xml files. In this case it is using the “replace” ant task to replace “<!DOCTYPE” with “<!– <!DOCTYPE” within the file named by temp.sun.web.
In general an ant build file has targets like “build” or “clean”. These depend on each other so that “test” runs “build” first. The targets are implemented by “tasks”, where each XML tag refers to a task. You can read their manual and refer to the per-task docs for how each task works.