Use plugin bill of materials

Simplify dependency management with the plugin bill of materials

Updating the versions of plugin dependencies manually can be exhausting, looking for the correct set of versions that work with each other and do not cause upper-bounds dependency error reports. The Jenkins plugin bill of materials simplifies that by shifting the evaluation of versions from each plugin author to a centralized process maintained by members of the Jenkins community.

Create a branch

In a local copy of your fork of the plugin repository create a git branch for your work with the command:

git checkout -b use-plugin-bom master

Use the plugin bill of materials

Add a dependencyManagement section to the dependencies section of the pom file that references the most recent version of the plugin bill of materials for that line. For example, the addition might look like:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.jenkins.tools.bom</groupId>
      <artifactId>bom-2.426.x</artifactId>
      <version>3120.v4d898e1e9fc4</version>
      <scope>import</scope>
      <type>pom</type>
    </dependency>
  </dependencies>
</dependencyManagement>

Remove as many <version> declarations from the pom file as you can while still compiling successfully.

Compile the plugin

Use Apache Maven to compile the plugin and run its automated tests with the command:

mvn clean verify

Confirm that there are no errors reported and no test failures reported.

Create a pull request

Commit that change:

git add pom.xml
git commit -m "Use plugin bill of materials for easier dependency management"

Push the change to GitHub:

git push origin --set-upstream use-plugin-bom
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for '{task-identifier}' on GitHub by visiting:
remote: https://github.com/user/your-plugin/pull/new/{task-identifier}
remote:
To github.com:user/your-plugin.git
 * [new branch]      {task-identifier} -> {task-identifier}
Branch '{task-identifier}' tracking remote branch '{task-identifier}'.

Notice that the output of the command includes the URL, which can be used to open a pull request. Copy that URL in your web browser and submit a pull request.