I have a number of projects running on a Hudson slave. I\'d like one of them to run Ant under Java6, rather than the default (which is Java5 in my environment).
In t
The best way is,
Individual slave agents can be configured to use specific JDKs on the system you run them on.
Manage Nodes > Slave > Configure > Environment Variables
For example
Name: JAVA_HOME Value: C:\Program Files (x86)\Java\jdk1.6.0_45\
Have a look at the Setenv Plugin. There you can set Variables like JAVA_HOME=C:/java/jdk1.6.1 PATH=%JAVA_HOME%/bin;%PATH%
I had a problem where the installed JDK was JDK 8 whereas I wanted Jenkins to use JDK 7 . So , after installing JDK 7 on the Jenkins build box ,
I added the JDK path to jenkins Configurations :
Jenkins -> Manage Jenkins -> Configure system -> JDK -> Add JDK name and Path
Also , Edit jenkins-runner.sh: Add the line:
export JAVA_HOME=""
Change the last two lines to read:
echo "/bin/java" $javaArgs -jar "$war" $args
exec "/bin/java" $javaArgs -jar "$war" $args
We managed this problem by using two different Java Hudson Nodes. One for Java 6 and one for Java 7. Then we assigned the Jobs to the different Nodes according to there needs.
A way to set custom environment variables for this project, which would allow me to set JAVA_HOME to the JDK6 location. The would make Ant pick up and run on Java6 as desired.
When configuring the Build steps for Ant, under "Invoke Ant", if you click "Advanced", you can set custom Java options. The on-screen help says:
If your build requires a custom ANT_OPTS, specify it here. Typically this may be used to specify java memory limits to use, for example -Xmx512m. Note that other Ant options (such as -lib) should go to the "Ant targets" field.
I have a feeling this won't work for the JDK to run under, however.
Have you configured multiple JDK installations for this Hudson instance under Manage Hudson
/ Configure System
?