How can I configure a Hudson job to use a specific JDK?

后端 未结 9 1835
情话喂你
情话喂你 2020-12-05 06:44

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

相关标签:
9条回答
  • 2020-12-05 07:17

    The best way is,

    1. Install all required JDKs to your system.
    2. Add those to jenkins under JDK title in configuration page.
    3. Install Maven Info plugin to jenkins
    4. Restart jenkins
    5. Go to your job configuration page.
    6. Select required JDK from the JDK combo box appear under Maven Info Plugin Configuration
    7. Build it
    8. Enjoy!!!
    0 讨论(0)
  • 2020-12-05 07:18

    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\

    0 讨论(0)
  • 2020-12-05 07:21

    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%

    0 讨论(0)
  • 2020-12-05 07:22

    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

    0 讨论(0)
  • 2020-12-05 07:26

    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.

    0 讨论(0)
  • 2020-12-05 07:28

    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?

    0 讨论(0)
提交回复
热议问题