Hi there,
Has anyone tried to pass in params to a called target via 'calltarget' of
antcontrib (without creating new project) OR maybe a different way to
achieve this goal (pass param to a called target without creating new
project) I've tried using <variable> (set and unset after the target is
called) but no success, the called target sees always the first value of
that variable
thank you
Jan.Materne wrote:
>
> <target name="run" if="class">
> <java classname="${class}"/>
> </target>
>
> $ ant -Dclass=MyClass
> $ ant -Dclass=YourClass
> $ ant -Dclass=HisClass
>
>
> or
>
>
> <macrodef name="run">
> <attribute name="class" default="MyClass"/>
> <sequential>
> <java classname="@{class}"/>
> </sequential>
> </macrodef>
> <target name="run-a">
> <run/>
> </target>
> <target name="run-b">
> <run class="YourClass"/>
> </target>
> <target name="run-C">
> <run class="HisClass"/>
> </target>
>
>
>
> or
>
> <target name="-run">
> <java classname="${class}"/>
> </target>
> <target name="run-a">
> <antcall target="-run">
>
> </antcall>
> </target>
> ...
>
>
> Jan
>
>
>
>
>>-----Ursprüngliche Nachricht-----
>>Von: hezjing [mailto:[email protected]]
>>Gesendet: Mittwoch, 8. August 2007 12:08
>>An: ant-users
>>Betreff: Call a target with parameter?
>>
>>Hi!
>>
>>My build.xml contains few targets to run different main classes,
>>
>> <target name="run-a">
>> <java classname="MyClass" />
>> </target>
>> <target name="run-b">
>> <java classname="YourClass" />
>> </target>
>> <target name="run-c">
>> <java classname="HisClass" />
>> </target>
>>
>>
>>Can I simplify this by defining one target with <java> and the common
>>classpath and system properties configuration, and then call this
>>target with different class names?
>>
>>
>>--
>>
>>Hez
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [email protected]
>>For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Call-a-target-with-parameter--tp12050352p21610285.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]