0
votes

I'm trying to compile my projects with ANT build script. When I change the Eclipse workspace default JRE, let say to JDK1.6.0_27 32bit the ANT still using JRE 1.7.0 64bit (which is system default)

There is an option to set ANT build file to use different java version by setting "External Tools Configuration", selecting ANT build file and selecting relevant java in "JRE" tab, but that is strange, because there is option in the same place to use "Run in the same JRE as the workspace", which doesn't works for me (running Eclipse Indigo 3.7).

That can be not problem when you have an one project with one ANT script, but I have an 7 projects with 7 build files, and I need to make 2 different releases: one with Java 1.6 32bit, and one Java 1.7 64bit. Selection of required settings manually each time (I'm building releases almost every day) became the real 'pain in the ass'.

1
ANT is a standalone tool. It uses the JAVA_HOME variable to determine which JDK to use on startup.Mark O'Connor
That's okay that ANT is standalone, but, since it is integrated into Eclipse AND there is option in Eclipse to use different settings, your response does not really helps me to solve the problem. Is there some solution? Is it a non solved BUG of Eclipse/ANT?kpoxa
Ok that wasn't clear to me. I thought you were expecting ANT to use the JDKdefined in the Eclipse project settings files, when run from the command-line or a CI server like Jenkins.Mark O'Connor

1 Answers

0
votes

Okay, I found the solution by myself. I was created new ANT build file and called from it to the other ANT files, like this:

<project name="build-all" default="build.all">

<target name="proj1">
    <ant antfile="build-proj1.xml" target="build" inheritAll="false"/>
</target>

<target name="proj2">
    <ant antfile="build-proj2.xml" target="build" inheritAll="false"/>
</target>

<target name="proj3">
    <ant antfile="build-proj3.xml" target="build" inheritAll="false"/>
</target>

<target name="build.all" depends="proj1,proj2,proj3"/>

Now I can go to the Eclipse, change the target to desired JRE version for this top level ANT file, all sub build files are executed using the parent's settings.