future-proofing java version check in ant script
Posted
by carneades
on Stack Overflow
See other posts from Stack Overflow
or by carneades
Published on 2010-03-29T04:35:28Z
Indexed on
2010/03/29
4:43 UTC
Read the original article
Hit count: 361
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?
© Stack Overflow or respective owner