Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Ant targets

Thread view: 
Rod - 24 Jun 2005 20:29 GMT
I need to write an ant script which has several targets.

The script must be able to differentiate, when invoked,
between two conditions ...call the conditions A or B.

Based on whether condition A or B is specified, the value
of several properties will be set differently. These
properties affect all other targets.

I envision calling the script something like this :

ant A targetX ( or ant B targetY )

Basically, the fact that A was specified would cause
several properties to be uniquely set and their values available
to all other targets.

I am not sure how to accomplish this.

I know I can create two targets ( A and B ) and
set the necessary parameters ..the question is then
how to pickup that second parameter ( targetX ) ...the
specific target I really wanted to execute !
( targetX / targetY in my example above )

Any ideas ?
Raymond DeCampo - 25 Jun 2005 03:30 GMT
> I need to write an ant script which has several targets.
>
[quoted text clipped - 22 lines]
>
> Any ideas ?

Well, first of all, ant supports passing multiple targets on the command
line, like make.  So if you have targets A, B, targetX, targetY invoking
"ant A targetX" is no problem.

Now this might not be the best way to accomplish what you need.  Ant
<target> tags accept unless and if attributes that can cause the target
to be skipped even when explicitly invoked.  These may be a help to you.

HTH,
Ray

Signature

XML is the programmer's duct tape.

Rod - 26 Jun 2005 03:32 GMT
Thanks ...that helps.

> > I need to write an ant script which has several targets.
> >
[quoted text clipped - 33 lines]
> HTH,
> Ray
Rod - 30 Jun 2005 14:22 GMT
Thanks for reply ...yes, I know about "depends" ...my situation is that
I need to set the values of several properties based on the "type" of
run being made ( production, local, etc. ) ...additionally, once the
-type- of run is identified, one of several targets may be executed
...yes, I could expect the user to load a particular properties file
..etc, etc. , however, I wanted to keep the ant command as simple as
possible ...hence two targets  ...I just wanted to veify that the
caller actually passed in two targets before starting any -real- work.
Currently, I scrapped the two target idea in favor of defining a
property on the ant call ( i.e. ant -Dtarget="DEV" target1 ) and
validating that the property was passed in ...seems though that there
must be a "cleaner" way ....


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.