I have written a number of Ant 'functions' like this:
----------------------------------------------------------------------------
-----------
<project name="buildhtml" default="buildhtml">
<!-- PARAMETERS
item - The identification name of the item.
inputdir - The directory where the item's source xml is located.
outputdir - The directory where one desires the output html to go.
graphics.prefix - The prefix to where callout graphics and admonitions
are located, e.g (../../)
-->
<target name="buildhtml" description="Builds HTML output for an item">
<!-- Load in properties -->
<loadproperties srcFile="ant.properties"/>
<available file="${inputdir}/files" type="dir"
property="files.available"/>
<antcall target="copyfiles"/>
<exec executable="java">
...
</exec>
<copy file="${inputdir}/${item}.xml" tofile="${outputdir}/${item}.xml"/>
</target>
<target name="copyfiles" if="files.available" description="Copies needed
files">
<echo>Copying required files for ${item} from ${inputdir} to
${outputdir}</echo>
<copy todir="${outputdir}/files"><fileset
dir="${inputdir}/files"/></copy>
</target>
</project>
----------------------------------------------------------------------------
-----------
I would like to call them from Java programs by simply setting the
properties
that correspond to the parameters mentioned at the top.
I have been messing around trying to do this for a few hours now and it is
doing my head in, any help would be greatly appreciated.
I preferably want the output from the programs to goto stdout and stderr
as normal. I want to do something like this:
Ant ant = new Ant();
ant.setProperty("item", "blahblah");
ant.setProperty("inputdir", "blahblah");
ant.setProperty("outputdir", "blahblah");
ant.setAntfile("buildhtml.xml");
ant.execute();
from within a Java program and have program control return to the line
after the call to the ant file.
Regards
[[[']]]
| ion |
[[[']]]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>