You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Pe...@syntegra.com on 2001/08/09 17:02:28 UTC

Conditional ANT building

Since some of the tasks differ between 1.3 and 1.4alpha/beta, I want to
perform different things for different ANT versions.  
I can obtain the ANT version using the property ant.java.version, but is
there some way to say:

if ${ant.java.version} == "1.3" 
   echo "Using ANT 1.3"
else if ${ant.java.version} == "1.4"
   do something else....


Is this possible?

Peter


********************************************************************

This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person
Thank you

Check us out at http://www.syntegra.com

********************************************************************

Re: Conditional ANT building

Posted by T Master <tm...@iknowledgeinc.com>.
How would someone check for a jvm of 1.3 being used, and those less than?
I want to enforce a fixed jdk version for development.
I use ant1.3 (currently).


----- Original Message ----- 
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Thursday, August 09, 2001 9:15 AM
Subject: Re: Conditional ANT building


> On Thu, 9 Aug 2001, Peter FLYNN <Pe...@syntegra.com> wrote:
> 
> > I can obtain the ANT version using the property ant.java.version,
> 
> ant.version, not ant.java.version.
> 
> > but is there some way to say:
> > 
> > if ${ant.java.version} == "1.3" 
> >    echo "Using ANT 1.3"
> > else if ${ant.java.version} == "1.4"
> >    do something else....
> 
> To do different things for 1.4 and earlier versions? Yes, but only
> because ant.version will not be defined in Ant 1.3, so you can use
> target's if/unless attributes and this property.
> 
> For versions after that, <condition> and the <equals> condition should
> help.
> 
> Stefan
> 


Re: Conditional ANT building

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 9 Aug 2001, Peter FLYNN <Pe...@syntegra.com> wrote:

> I can obtain the ANT version using the property ant.java.version,

ant.version, not ant.java.version.

> but is there some way to say:
> 
> if ${ant.java.version} == "1.3" 
>    echo "Using ANT 1.3"
> else if ${ant.java.version} == "1.4"
>    do something else....

To do different things for 1.4 and earlier versions? Yes, but only
because ant.version will not be defined in Ant 1.3, so you can use
target's if/unless attributes and this property.

For versions after that, <condition> and the <equals> condition should
help.

Stefan

Re: Conditional ANT building

Posted by Matthew Inger <ma...@sedonacorp.com>.
Peter.FLYNN@syntegra.com wrote:

>Since some of the tasks differ between 1.3 and 1.4alpha/beta, I want to
>perform different things for different ANT versions.  
>I can obtain the ANT version using the property ant.java.version, but is
>there some way to say:
>
>if ${ant.java.version} == "1.3" 
>   echo "Using ANT 1.3"
>else if ${ant.java.version} == "1.4"
>   do something else....
>
>
>Is this possible?
>
>Peter
>
>
>********************************************************************
>
>This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person
>Thank you
>
>Check us out at http://www.syntegra.com
>
>********************************************************************
>

<target name="performtasks-1.3">
</target>

<target name="performtasks-1.4">
</target>

<target name="performtasks">
 <antcall target="performtasks-${ant.java.version}" />
</target>


however, i don't think that's the property you really want,
since ant.java.version actually returns the version of the current
virtual machine, not the version of ant.


-- 
Matt Inger (matt.inger@sedonacorp.com)
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken