A look into Ant's buildfile [1] would help ;-)
Ant has support classes for different JDKs, but must be able to build on a JDK
1.2.
Therefore there are mechanisms for handling that:
<available property="jdk1.3+" classname="java.lang.StrictMath"/>
<available property="jdk1.4+" classname="java.lang.CharSequence"/>
<available property="jdk1.5+" classname="java.lang.Readable"/>
Simply checks for the existence of a 'newer' class.
Then you can use conditional targets
<target if="jdk1.5+">
<!-- do Java5 stuff -->
</target>
Jan
[1] http://svn.apache.org/repos/asf/ant/core/trunk/build.xml
>-----Ursprüngliche Nachricht-----
>Von: Scot P. Floess [mailto:[EMAIL PROTECTED]
>Gesendet: Freitag, 12. Mai 2006 03:04
>An: Ant Users List
>Betreff: Re: ant 1.6.2 conditional issue
>
>Which version of ant are you using? Looks like the
>documentation for <if> states ant 1.5 or later...If you are
>using a 1.4 version, maybe move up to ant 1.6.5 - its awesome :)
>
>The problem (its not really a problem) in using conditions is
>that it may force you to use something like a:
>
>condition ... set property X
>
>condition ... set property Y
>
>condition ... set property Z
>
>...
>
>target if = X
>
>target if = Y
>
>target if = Z
>
>I'm not saying this is necessarily -bad- but sometimes using
><if> can make the intent more clearer - at least later on ;)
>
>I'd really encourage you to see which version of ant you are using :)
>
>Jignesh Shah wrote:
>> Hi,
>>
>> I am using ant 1.6.2 and my ant build need to do seperate
>things based
>> on the jvm the developer is using to build the project. I thought of
>> doing:
>>
>> <target name="mytarget">
>> <if>
>> <equals jdkversion="1.5"
>> versiononbox="${ant.java.version}" />
>> <then>
>> <echo message="ant.java.version:${ant.java.version}"
>> />
>> </then>
>> <else>
>> <echo message="ant.java.version: is not the one we want - do
>something
>> else" /> </else> </if> </target>
>>
>> but somehow it says my ant version does not support this... is there
>> anyway to convert it to <conditional> & <contains>, I could not find
>> the exact syntax anywhere..
>>
>> thanks,
>> Jignesh
>>
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED] For
>additional
>> commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>--
>Scot P. Floess
>27 Lake Royale
>Louisburg, NC 27549
>
>252-478-8087 (Home)
>919-754-4592 (Work)
>
>Chief Architect JPlate http://sourceforge.net/projects/jplate
>Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>
>
>---------------------------------------------------------------------
>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]