You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Emanuele Gesuato <em...@virgilio.it> on 2009/01/17 22:36:35 UTC
Splitting "args" in an ant target
Hi there,
In a my ant script, i've a target similar to the following:
<target name="run-class" description="Executes Warp." >
<java classname="com.MyClass" fork="yes" dir="..">
<classpath>
<path refid="java.class.path"/>
</classpath>
<arg value="c"/>
<arg line="/C ${app.creator}"/>
<arg line="${app.name}"/>
<arg value="${app.package}"/>
</java>
</target>
I would like to add an "arg" only in specific cases based on the
operating system in which the script is running.
So, i think to "group" the several arg lines outside the target in a way
similar to the following:
<args id="myargs">
<arg value="c"/>
<arg line="/C ${app.creator}"/>
<arg line="${app.name}"/>
<arg value="${app.package}"/>
</args>
<target name="run-class" description="Executes Warp." >
<java classname="com.MyClass" fork="yes" dir="..">
<classpath>
<path refid="java.class.path"/>
</classpath>
<arg refid="myargs" />
</java>
</target>
Is it possible ? Which task should i use ?
Or are there more polite ways to accomplish this ?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Splitting "args" in an ant target
Posted by David Weintraub <qa...@gmail.com>.
What about the <condition> property? That can be used to check the OS.
<condition property="parameters"
value="Windows Parameters"
else="Unix Parameters">
<os family="windows"/>
</condition>
<java classname="com.MyClass" fork="yes" dir="..">
<classpath>
<path refid="java.class.path"/>
</classpath>
<arg line="${parameters}" />
</java>
On Sat, Jan 17, 2009 at 4:36 PM, Emanuele Gesuato
<em...@virgilio.it> wrote:
> Hi there,
>
> In a my ant script, i've a target similar to the following:
>
> <target name="run-class" description="Executes Warp." >
> <java classname="com.MyClass" fork="yes" dir="..">
> <classpath>
> <path refid="java.class.path"/>
> </classpath>
> <arg value="c"/>
> <arg line="/C ${app.creator}"/>
> <arg line="${app.name}"/>
> <arg value="${app.package}"/>
> </java>
> </target>
>
>
> I would like to add an "arg" only in specific cases based on the operating
> system in which the script is running.
>
> So, i think to "group" the several arg lines outside the target in a way
> similar to the following:
>
> <args id="myargs">
> <arg value="c"/>
> <arg line="/C ${app.creator}"/>
> <arg line="${app.name}"/>
> <arg value="${app.package}"/>
> </args>
>
> <target name="run-class" description="Executes Warp." >
> <java classname="com.MyClass" fork="yes" dir="..">
> <classpath>
> <path refid="java.class.path"/>
> </classpath>
> <arg refid="myargs" />
> </java>
> </target>
>
>
> Is it possible ? Which task should i use ?
>
> Or are there more polite ways to accomplish this ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
--
--
David Weintraub
qazwart@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org