How to change the JDK for a Jenkins job?

后端 未结 8 2528
臣服心动
臣服心动 2020-12-09 14:46

\"enterI have imported the jenkins jobs from existing jenkins server from another machine. But

相关标签:
8条回答
  • 2020-12-09 15:02

    Here is where you should configure in your job:

    In JDK there is the combobox with the different JDK configured in your Jenkins. Job

    Here is where you should configure in the config of your Jenkins:

    Jenkins general config

    0 讨论(0)
  • 2020-12-09 15:04

    Be careful with jobs

    1 - if you have a job based in maven, Jenkins takes your default java configuration and you decide the compilation level in your POM.XML.

    2 - if you have a free style job, in the the configuration option of the job you can select the JDK that you want to use.

    Hope this help.

    0 讨论(0)
  • 2020-12-09 15:08

    Here is my experience with Jenkins version 1.636: as long as I have only one "Install automatically" JDK configured in Jenkins JDK section, I don't see "JDK" dropdown in Job=>Configure section, but as soon as I added second JDK in Jenkins config, JDK dropdown appeared in Job=>Configure section with 3 options [(System), JDK1, JDK2]

    0 讨论(0)
  • 2020-12-09 15:10

    For existing jobs you're editing, the JDK drop-down choice may not be available if you've just added a single JDK config in the 'Configure System' Jenkins settings.

    However, it is available for new jobs.

    Surprisingly, if you add a second JDK config, it becomes available in an existing job too.

    This looks to me like a bug (tested in Jenkins ver. 1.629).

    See a similar issue raised here: JDK selection is hidden even when a JDK is configured

    0 讨论(0)
  • 2020-12-09 15:13

    Using latest Jenkins version 2.7.4 which is also having a bug for existing jobs.

    1. Add new JDKs through Manage Jenkins -> Global Tool Configuration -> JDK ** If you edit current job then JDK dropdown is not showing (bug)

    2. Hit http://your_jenkin_server:8080/restart and restart the server

    3. Re-configure job

    Now, you should see JDK dropdown in "job name" -> Configure in Jenkins web ui. It will list all JDKs available in Jenkins configuration.

    0 讨论(0)
  • 2020-12-09 15:16

    If you have a multi-config (matrix) job, you do not have a JDK dropdown but need to configure the jdk as build axis.

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