ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vijay Aravamudhan <>
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
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 -->
            <equals arg1="${}" arg2="1.4" />
            <fail message="Not running ant with JDK 1.4 - this will 
result in differing class versions" />

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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message