ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Problems with <ant antfile..> and <java>
Date Thu, 23 Sep 2010 04:16:23 GMT
On 2010-09-22, Gilbert Rebhan wrote:

> My workflow (Env : ant1.7.1,sun jdk1.6.0_17,windows)
> dynamically creates an antfile.

> The antfile has nothing special, only a <java> task and
> some <echo> for logging purposes.

> <java classname="..." resultproperty=".." outputproperty=".."
>  resultproperty=".." failonerror="true">
>  <arg value="some arg"/>
>  <arg value="foobar.xsd"/>
>  <arg value="foobar.xsd"/>
>  <classpath>
>   <fileset dir="path/to/generated/antfile">
>    <includes="*.jar"/>
>   </fileset>
> </java>

> foobar.xsd resides under path/to/generated/antfile,
> means =
> /path/to/generated/antfile
>  antfile.xml
>  foobar.xsd
>  ...

> The generated antfile has to be called from another
> antscript, but with =

> <ant antfile="path/to/generated/antfile/anfile.xml" inheritall="false"
>  dir="path/to/generated/antfile"/>

> i get a for <arg value="foobar.xsd"/>
> whereas running the generated antfile standalone just works fine.

You could use the dir attribute of the <java> task - which also means
you'd have to fork the task.  Note that the <ant> task can change the
basedir of your invoked build file in unexpected ways.

Another approach may be to give your generated project a name - say
"generated" - via the project's name attribute and then use

<dirname property="generated.basedir" file="${ant.file.generated}"/>

inside your generated file to find the absolute path of the directory
holding it and finally use

<arg value="${ant.file.generated}/foobar.xsd"/>


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

View raw message