Giter VIP home page Giter VIP logo

plugin-pom's Introduction

Parent POM for Jenkins Plugins

GitHub release GitHub license

Introduction

The plugin parent POM is decoupled from the core Jenkins project, both from a Maven perspective and a repository perspective. It provides a common build configuration for all Jenkins plugins.

Requirements

Since version 4.52, the plugin parent POM requires Jenkins 2.361 or newer and JDK 11 or newer. Since version 4.40, the plugin parent POM supports Java 17.

Usage

To use the plugin parent POM, change the parent POM of your plugin:

  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>VERSION</version> <!-- See https://github.com/jenkinsci/plugin-pom/releases for available versions-->
    <relativePath />
  </parent>

Then override the needed properties, e.g.:

  <properties>
    <!--
    Take a look the developer documentation for the baseline version to use
    https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/#currently-recommended-versions
    -->
    <jenkins.version>2.361.4</jenkins.version>
  </properties>

If you have a jar:test-jar execution, delete it and add the following to <properties>:

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

Overridable properties

The following properties are overridable:

  • jenkins.version: The Jenkins version required by the plugin. Mandatory. See Requirements for more info. Being able to specify the jenkins.version simplifies testing the plugin with different core versions, which is important (among other reasons) for Plugin Compatibility Testing (PCT).
  • 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 plugin parent POM.)
  • stapler-maven-plugin.version: The Stapler Maven plugin version required by the plugin.
  • In order to make their versions the same as the used core version, node.version and npm.version properties are provided.

Incrementals

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

Formatting

To opt in to code formatting of your Java sources and Maven POM with Spotless, define the spotless.check.skip property to false and remove any existing Spotless configuration from your POM.

To format existing code, run:

mvn spotless:apply

After formatting an existing repository, squash merge the PR and create a .git-blame-ignore-revs file to hide the formatting commit from blame tools.

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

Temporary workarounds

Running tests with Jetty 12 (EE 8)

To run tests with Jetty 12 (EE 8) with Jenkins 2.471 or older, add the following to pom.xml:

<!-- TODO JENKINS-73339 until in parent POM -->
<jenkins-test-harness.version>2254.vcff7a_d4969e5</jenkins-test-harness.version>
<maven.compiler.testRelease>17</maven.compiler.testRelease>

This will not be necessary in a future release of the plugin parent POM that requires Jenkins 2.472 or newer.

Running the entire build with Jetty 12 (EE 8):

To run the entire build with Jetty 12 (EE 8) and require Jenkins 2.472 or newer, add the following to pom.xml (adjusting your BOM version as necessary):

<jenkins.version>2.472</jenkins.version>
<!-- TODO JENKINS-73339 until in parent POM -->
<jenkins-test-harness.version>2254.vcff7a_d4969e5</jenkins-test-harness.version>
<maven.compiler.release>17</maven.compiler.release>

This will not be necessary in a future release of the plugin parent POM that requires Jenkins 2.472 or newer.

Running the entire build with Jetty 12 (EE 9):

To run the entire build with Jetty 12 (EE 9), first follow the steps in the preceding section, then add the following to pom.xml:

<dependencyManagement>
  <dependencies>
    <!-- TODO JENKINS-73339 until in parent POM, work around https://github.com/jenkinsci/plugin-pom/issues/936 -->
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <version>5.0.0</version>
    </dependency>
  </dependencies>
</dependencyManagement>

This will not be necessary in a future release of the plugin parent POM that requires Jetty 12 EE 9 or newer.

Javadoc

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.

Releasing

Tests are skipped during the perform phase of a release. This can be overridden by setting release.skipTests to false.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.