Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jenkinsci/plugin-pom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: plugin-4.88
Choose a base ref
...
head repository: jenkinsci/plugin-pom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: plugin-5.5
Choose a head ref
Loading
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@ updates:
interval: weekly
open-pull-requests-limit: 10
ignore:
# TODO https://github.com/jenkinsci/plugin-pom/issues/936 delete when baseline is 2.459+ -->
- dependency-name: "jakarta.servlet:jakarta.servlet-api"
versions: [">=5.0.0"]
- dependency-name: "org.jenkins-ci.main:jenkins-bom"
- dependency-name: "org.jenkins-ci.main:jenkins-core"
- dependency-name: "org.jenkins-ci.main:jenkins-war"
159 changes: 118 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ It provides a common build configuration for all Jenkins plugins.

## Requirements

Since version 5.0, the plugin parent POM requires Jenkins 2.479 or newer and JDK 17 or newer.
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.

@@ -75,6 +76,20 @@ After formatting an existing repository, squash merge the PR and create a
[`.git-blame-ignore-revs`](https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view)
file to hide the formatting commit from blame tools.

### Format as you build

You can set up `mvn spotless:apply` to run automatically (in `validate` phase) for projects which enabled spotless by adding the following to your `settings.xml`:

```xml
<settings>
[...]
<activeProfiles>
[...]
<activeProfile>may-spotless-apply</activeProfile>
</activeProfiles>
</settings>
```

## Running Benchmarks

To run JMH benchmarks from JUnit tests, you must run you must activate the `benchmark`
@@ -89,73 +104,135 @@ be detected when using `-Dbenchmark`, however, `FooBar` will be ignored.

See also: [documentation for JMH benchmarks](https://github.com/jenkinsci/jenkins-test-harness/blob/master/docs/jmh-benchmarks.adoc)

## Temporary workarounds
## Javadoc

### Running tests with Jetty 12 (EE 8)
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.

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

```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>
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:

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

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

### Running the entire build with Jetty 12 (EE 8):
If you want to add `npm` or `yarn` to your plugin, you can do so by creating a marker file:

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):
For npm:

```xml
<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>
```bash
touch .mvn_exec_node
```

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

### Running the entire build with Jetty 12 (EE 9):
```bash
touch .mvn_exec_yarn
```

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`:
You need to add corresponding properties to your `pom.xml` and set them to valid values:

For npm:
```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>
<properties>
<node.version>set this to the latest node lts version</node.version>
<npm.version>set this to the latest npm version</npm.version>
</properties>
```

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

## Javadoc
```xml
<properties>
<node.version>set this to the latest node lts version</node.version>
<yarn.version>set this to the latest yarn version</yarn.version>
</properties>
```

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.
### Configuring Jest to report results to Jenkins

## Releasing
Our [pipeline-library](https://github.com/jenkins-infra/pipeline-library) configures the Maven build to not fail the build when there is test failures so that Jenkins is able to report on the test failures itself.

Tests are skipped during the `perform` phase of a release. This can be overridden by setting `release.skipTests` to false.
This requires the tests to be configured to output a JUnit report in a supported location.

## Setup Wizard
To do this you can install `jest-junit`:

By default, the setup wizard (Jenkins >= 2.0) is skipped when using `hpi:run`. If you want the wizard to be enabled just run:
```bash
npm install --dev jest-junit
```

```bash
mvn -Dhudson.Main.development=false hpi:run
yarn add --dev jest-junit
```

Then configure jest-junit by modifying the `package.json`:

```json
{
"scripts": {
"mvntest": "npm test",
"test": "jest --ci --reporters=default --reporters=jest-junit"
},
"jest-junit": {
"outputDirectory": "target/surefire-reports",
"outputName": "jest-junit.xml"
}
}

```

<!-- TODO when enough plugins have adopted this then remove this step -->
Then set the following properties in your `pom.xml` to configure the Maven build to let Jenkins report the results:

```xml
<properties>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<frontend.testFailureIgnore>${maven.test.failure.ignore}</frontend.testFailureIgnore>
</properties>
```

### Configuring eslint to report results to Jenkins

To configure the Maven build to report the eslint results to Jenkins you will need to setup the `eslint-formatter-checkstyle` formatter.

First install it:

```bash
npm install --dev eslint-formatter-checkstyle
```

```bash
yarn add --dev eslint-formatter-checkstyle
```

Then configure eslint, depending on your configuration it should look something like this:

```json
{
"scripts": {
"mvntest": "eslint src/main/js -f checkstyle -o target/eslint-warnings.xml --ext js"
}
}
```

<!-- TODO when enough plugins have adopted this then remove this step -->
Then set the following properties in your `pom.xml` to configure the Maven build to let Jenkins report the results:

```xml
<properties>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<frontend.testFailureIgnore>${maven.test.failure.ignore}</frontend.testFailureIgnore>
</properties>
```


## Jenkins Core BOM

Since version 2.195, Jenkins provides a [Maven Bill Of Materials (BOM)](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
Loading