Skip to content
Parent POM for Jenkins Plugins
Java Groovy
Branch: master
Clone or download
This branch is 853 commits ahead of andresrc:master.

Latest commit

oleg-nenashev Merge pull request #301 from jenkinsci/dependabot/maven/org.apache.ma…
…ven.plugins-maven-site-plugin-3.9.0

Bump maven-site-plugin from 3.8.2 to 3.9.0
Latest commit fc82f5f Mar 18, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dependabot
.github
src/it
.gitignore
CHANGELOG.md
CONTRIBUTING.adoc Restore the release drafter link Dec 24, 2019
Jenkinsfile no need to enable the profile - its always active now Dec 18, 2019
LICENSE Ignores and License Jan 8, 2016
README.md add link to show all bom versions Jan 6, 2020
pom.xml

README.md

Parent POM for Jenkins Plugins

GitHub release GitHub license

Introduction

This new parent POM is decoupled from the core Jenkins project, both from the Maven and repository perspectives.

Since version 4.0 the plugin pom supports Jenkins 2.200 and higher and a select few older LTS lines (full list)

The main changes are:

  • Reduced number of overridable properties. All references (e.g. dependencies and plugin versions) not thought to be overridden are no longer based on properties. The main remaining overridable properties are:
    • jenkins.version: The Jenkins version required by the plugin. Mandatory.
    • java.level: The Java version to use to build the plugin. Mandatory. Should match the minimum Java version for the selected Jenkins version. See Java Support for more info.
    • jenkins-test-harness.version: The JTH version used to test plugin. Uses split test-harness (see JENKINS-32478).
    • hpi-plugin.version: The HPI Maven Plugin version used by the plugin. (Generally you should not set this to a version lower than that specified in the parent POM.)
    • stapler-plugin.version: The Stapler Maven plugin version required by the plugin.
    • java.level.test: The Java version to use to build the plugin tests.
    • In order to make their versions the same as the used core version, node.version and npm.version properties are provided.
  • Tests are skipped during the perform phase of a release (can be overridden by setting release.skipTests to false).
  • Javadoc has been set to quiet by default in 2.20+, which means it will only log errors and warnings. If you really want it verbose, set quiet property to false for the plugin.
  • General clean up.

Being able to specify the jenkins.version simplifies testing the plugin with different core versions, which is important, among others, for the Plugin Compatibility Testing.

Usage

In order to use the new POM:

  • Change the parent POM of your plugin:
  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>3.43</version> <!-- or whatever the newest version available is -->
    <relativePath />
  </parent>
  • Override the needed properties, e.g.:
  <properties>
    <jenkins.version>2.60.1</jenkins.version>
    <java.level>8</java.level>
  </properties>

If you had a jar:test-jar execution, delete it and add to properties:

<no-test-jar>false</no-test-jar>

Java support

The plugin POM is designed for plugin builds with JDK 8 or above, but target java.level for a plugin may differ from a JDK version used for the build. Starting from Plugin POM 3.44, support of Java 7 targets in Plugin POM is deprecated and has been removed in 4.0, java.level=8 and jenkins.version>2.204.1 are expected to be used for most plugins.

Incrementals

You can configure your plugin to treat every commit as a release candidate. See Incrementals for details.

Running Benchmarks

To run JMH benchmarks from JUnit tests, you must run you must activate the benchmark profile. For example:

mvn -P jmh-benchmark test

When the jmh-benchmark profile is enabled, no tests apart from JMH benchmarks will be run. The names of the classes containing the benchmark runners should either begin with or end with the word Benchmark. For example, FooBenchmark and BenchmarkFoo will be detected when using -Dbenchmark, however, FooBar will be ignored.

See also: documentation for JMH benchmarks

Setup Wizard

By default, the setup wizard (Jenkins >= 2.0) is skipped when using hpi:run. If you want the wizard to be enabled just run:

mvn -Dhudson.Main.development=false hpi:run

Jenkins Core BOM

Since version 2.195, Jenkins provides a Maven Bill Of Materials (BOM) that centrally defines versions of various libraries used by Jenkins Core and should make it easier to update to newer Jenkins Core versions

For more information, see the Dependency Management section of the plugin development guide.

You can’t perform that action at this time.