JDK locations in Cloudbees Jenkins (for maven toolchains.xml)

469 Views Asked by At

I'd like to create a Jenkins build job on DEV@cloud that uses Maven toolchain support, for integration tests of an annotation processor. I'd like to use JDK 6, JDK 7 and JDK 8, which are all available on DEV@cloud...

I could go ahead and try them out, printing the JAVA_HOME locations and then create a toolchain.xml file specifically for DEV@cloud myself, hoping they don't change paths. But it would be nicer if those tool locations were provided more officially.

Is there a toolchain.xml file available already, or some documentation on fixed JDK locations?

1

There are 1 best solutions below

0
On

Could not find an official way, but here are the steps and result so others don't have to do it. I am using the Jenkins Config File Provider Plugin to distribute the resulting xml:

  1. Discover (via job): find -L /opt/jdk/ -name java -path '*latest/bin/java'
  2. Make an xml file manually and add to Config File Provider. (Yes it really should integrate with the tool provider internals.). This is what I came up with and it may be valid for you too.

<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.6</version>
    <vendor>openjdk</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/openjdk6.latest</jdkHome>
  </configuration>
</toolchain>
<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.7</version>
    <vendor>openjdk</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/openjdk7.latest</jdkHome>
  </configuration>
</toolchain>

<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.8</version>
    <vendor>openjdk</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/openjdk8.latest</jdkHome>
  </configuration>
</toolchain>



<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.6</version>
    <vendor>sun</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/jdk1.6.latest</jdkHome>
  </configuration>
</toolchain>
<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.7</version>
    <vendor>sun</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/jdk1.7.latest</jdkHome>
  </configuration>
</toolchain>

<toolchain>
  <type>jdk</type>
  <provides>
    <version>1.8</version>
    <vendor>sun</vendor>
  </provides>
  <configuration>
    <jdkHome>/opt/jdk/jdk8.latest</jdkHome>
  </configuration>
</toolchain>