ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ion" <>
Subject Running Ant from Java
Date Wed, 11 Sep 2002 14:03:15 GMT
I have written a number of Ant 'functions' like this:

<project name="buildhtml" default="buildhtml">
    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=""/>
    <available file="${inputdir}/files" type="dir"

    <antcall target="copyfiles"/>

    <exec executable="java">

    <copy file="${inputdir}/${item}.xml" tofile="${outputdir}/${item}.xml"/>

  <target name="copyfiles" if="files.available" description="Copies needed
    <echo>Copying required files for ${item} from ${inputdir} to
    <copy todir="${outputdir}/files"><fileset

I would like to call them from Java programs by simply setting the
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");

from within a Java program and have program control return to the line
after the call to the ant file.


| ion |

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message