ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vijay Aravamudhan <avij...@gmail.com>
Subject Is there an ant task (inbuilt in ant core) to verify the version of a jre?
Date Thu, 25 Oct 2007 16:33:24 GMT
hi,
On many of my projects, we need to compile against the 1.4 JDK. 
Depending on what any individual developer might have installed, we run 
into issues with JDK versions ranging from 1.4.x, 1.5.x and 1.6.
Does anyone know if there is a task in ant which can be used to verify 
the version of the JDK and possibly fail the build if the version does 
not match what the project needs? (For eg: The limitation could be that 
the app server being used does not support more than JDK 1.4)

To get around this currently, I have the following lines at the top of 
the build file:
    <!-- allows non-standard tasks <foreach> and <if> -->
    <taskdef resource="net/sf/antcontrib/antlib.xml" 
classpath="lib/compile/ant-contrib.jar" />

    <!-- verify that the current java version is correct -->
    <if>
        <not>
            <equals arg1="${ant.java.version}" arg2="1.4" />
        </not>
        <then>
            <fail message="Not running ant with JDK 1.4 - this will 
result in differing class versions" />
        </then>
    </if>

But, as you can see, this creates a dependency on the ant-contrib jar. 
What I would like to achieve is the same - but without having to include 
the ant-contrib jar.

thanks,
Vijay

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


Mime
View raw message