Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

future-proofing java version check in ant script

Tags:

java

ant

The script provided here gave a great way to check if Ant is using Java 6.

<?xml version="1.0" encoding="UTF-8"?>

<project name="project" default="default">

    <target name="default" depends="javaCheck" if="isJava6">
        <echo message="Hello, World!" />
    </target>

    <target name="javaCheck">
        <echo message="ant.java.version=${ant.java.version}" />
        <condition property="isJava6">
            <equals arg1="${ant.java.version}" arg2="1.6" />
        </condition>
    </target>

</project>

However, I have good reason to think the next person holding my position may not be a Java programmer and I want to make sure the builds don't fail because of Java 7. Is there any way to pick apart a String or otherwise ask for Java 6 or higher?

like image 811
Yuvi Masory Avatar asked Dec 31 '25 04:12

Yuvi Masory


1 Answers

Beware, the ant.java.version returns the JDK version with which Ant is built till Ant 1.6.5...

like image 70
Girish Adat Avatar answered Jan 05 '26 09:01

Girish Adat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!