Child pages
  • Choosing Jenkins version to build against
Skip to end of metadata
Go to start of metadata

Your plugin's POM controls which version of Jenkins it is building/testing against.

Choosing a version

You need to balance compatibility and features:

  • Keeping the Jenkins version your plugin builds against low will allow more users to install and use your plugin. In particular, the LTS Release Line is based on slightly older releases to provide a more stable experience for conservative users.
  • Building against recent Jenkins versions allows you to use recently added core features and API from your plugin. You will also use that newer version for mvn hpi:run, so it may be easier to test your plugin with newer Jenkins releases. Additionally, since features are sometimes moved from core into plugins, depending on a more recent Jenkins version will make your plugin's dependencies on what used to be core features explicit, otherwise your plugin will not work.

There are statistics how many users have at least a specific version of Jenkins that can help you decide. These are updated monthly.

There are also statistics of core versions used by plugins to help you select a popular core version.

(question) General tip: When upgrading, choose the newest LTS version that doesn't alienate the majority of users of your latest few releases (by requiring a newer Jenkins than they have).

To depend on a released version of Jenkins

If your are using the Plugin Parent POM version 2.3 or later, just set the jenkins.version property to the version you need to depend on. For 1.x versions of the Plugin Parent POM, change project/parent/version to the version of Jenkins/Hudson you want to depend on. For parent version 1.396 or higher use groupId org.jenkins-ci.plugins. Up through 1.395 the groupId was org.jvnet.hudson.plugins.

To depend on the latest bleeding-edge trunk (or RC)

This is probably only useful in the early stages of plugin development, or when implementing a new feature that needs a very new core feature/API.

First, you'd need to build the trunk or RC of Jenkins by yourself.

Then, go back to your plugin, and if your are using the Plugin Parent POM version 2.2 or later, just set the jenkins.version property to the version number of Jenkins you just built. It should look something like "1.646-SNAPSHOT".If your are using an 1.x version copy the following fragments into your POM's <dependencies> section, then replace the <version> tag to the version number of Jenkins you just built.

    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-war</artifactId>
      <type>war</type>
      <version>1.646-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-core</artifactId>
      <version>1.646-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-test-harness</artifactId>
      <version>1.646-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
 See for older versions pre version 1.395

It should look something like "1.345-SNAPSHOT".

    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-war</artifactId>
      <type>war</type>
      <version>1.345-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-core</artifactId>
      <version>1.345-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-test-harness</artifactId>
      <version>1.345-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>

When you do this, your parent POM version still control a few small aspects of the build, so it'd be good to keep that version as close as possible.

You should commit this change to the repository, so that others working on the same plugin would notice that they'd need to build the trunk, too. Once the new release comes along, you can delete this fragment and go back to the "specify the Jenkins version by the parent version" mode.

Note that while your plugin depends on a non-release version of Jenkins, Maven will refuse to let you release a plugin.

You may also need:

 <dependency>
   <groupId>org.jenkins-ci.main</groupId>
   <artifactId>maven-plugin</artifactId>
   <version>1.345-SNAPSHOT</version>
 </dependency>
  • No labels

1 Comment

  1. How does this work with LTS releases. If I make my plugin dependent on an LTS release, lets say 1.509.3. Can a Jenkins system using 1.510 install this plugin? Or is it locked to LTS releases 1.509.X? Or can it jump to the next LTS release? Can it be installed in the main line? If so which release?

    Lets presume that my plugin depends on a bug fix made in 1.1520, which has been backported to LTS 1.1509. How does Jenkins safe guard that this plugin can't be installed into 1.1510 - 1.1519?