Checking future java version of ant script

The script provided here provided 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 every reason to believe that the next person in my position may not be a Java programmer, and I want to make sure that the assembly does not crash due to Java 7. Is there a way to highlight a line or otherwise ask Java 6 or higher?

+3
source share
2 answers

Beware, ant.java.version returns the JDK version that Ant was built with before Ant 1.6.5 ...

+1
source

ContainsRegEx java. , . , javac JVM, . , , , , JVM.

0

Source: https://habr.com/ru/post/1738915/


All Articles