ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Can you get name of target to be run?
Date Wed, 05 Feb 2003 12:00:55 GMT
You can use a wrapper script for that:

I´ve attached two files: 
	ant2.bat  - the wrapper script which stores the targets in an ant
property and calls ant
	build.xml - test buildfile

After invoking
>ant2 target1 target2 target3 target1

I got

target1:
     [echo] Target 1
     [echo] Targetnames = target1::target2::target3::target1

target2:
     [echo] Target 2
     [echo] Targetnames = target1::target2::target3::target1

target3:
     [echo] Target 3
     [echo] Targetnames = target1::target2::target3::target1

target1:
     [echo] Target 1
     [echo] Targetnames = target1::target2::target3::target1

BUILD SUCCESSFUL
Total time: 1 second


Jan Matèrne

-----Ursprüngliche Nachricht-----
Von: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
Gesendet am: Mittwoch, 5. Februar 2003 06:48
An: Ant Users List
Betreff: Re: Can you get name of target to be run?

No.  And this has been a hotly debated topic, in fact.

Keep in mind that Ant can be run this way also:

	ant target1 target2 target3

That probably doesn't factor into why its a debatable topic, but does 
add some food for thought on it.

You could do something like this though:

	ant -Dtarget=target1

And in the default target do an <antcall> to ${target}

	Erik


On Tuesday, February 4, 2003, at 06:07  PM, David Clements wrote:
> Can you get the name of the target that is going to be run upon entry 
> into the build file?  I want to set a
> property based on what target is going to be run.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ant-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ant-user-help@jakarta.apache.org


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message