Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Ant targets (http://www.velocityreviews.com/forums/t144433-ant-targets.html)

Rod 06-24-2005 07:29 PM

Ant targets
 
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 06-25-2005 02:30 AM

Re: Ant targets
 
Rod wrote:
> 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 ?
>


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

--
XML is the programmer's duct tape.

Rod 06-26-2005 02:32 AM

Re: Ant targets
 
Thanks ...that helps.

Raymond DeCampo wrote:
> Rod wrote:
> > 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 ?
> >

>
> 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
>
> --
> XML is the programmer's duct tape.



Rod 06-30-2005 01:22 PM

Re: Ant targets
 
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 ....



All times are GMT. The time now is 07:23 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.