• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to define an ant task for java version is 1.6.0_05 or higher

 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to define an Ant task to enforce that the java version should be 1.6.0_05 or higher?

The following build.xml fails with the error message:
BUILD FAILED
C:\workspace\Test_TIJ4\build.xml:51: The following error occurred while executing this line:
C:\workspace\Test_TIJ4\object\build.xml:29: J2SE6 required

build.xml (partial, not the entire file)
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On line 9, the "unless" clause should check for "version1.6" - that is the property that the condition sets.

If you want to allow any 1.6 or 1.7 JVM, you could use this condition:



According to the docs, the ant.java.version property is only two parts: http://ant.apache.org/manual/properties.html#built-in-props

Why do you want to disallow a 1.6 JVM prior to 1.6.0_05?
 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to allow any 1.6 or 1.7 JVM for jdk 1.6.0_05 or higher.
The ant version is 1.7.0 (I can't use a newer version).
The build.xml file is changed as per your advice and the error message is now:
BUILD FAILED
C:\workspace\Test_TIJ4\build.xml:51: The following error occurred while executing this line:
C:\workspace\Test_TIJ4\object\build.xml:21: equals doesn't support the "string" attribute

 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The build.xml file can be compiled by changing to:
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, sorry, when I started to write the code I meant to use the <substring> condition but switched to <equals> and then forgot to change the property names.

By the way, it is very distracting to quote the entire previous post when replying, so I removed the quotes for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic