Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jenkinsci/plugin-pom into jenkins…
Browse files Browse the repository at this point in the history
…-xxx.version
  • Loading branch information
jglick committed May 14, 2020
2 parents 88c7446 + 3b34585 commit 9cd101c
Show file tree
Hide file tree
Showing 27 changed files with 344 additions and 504 deletions.
4 changes: 4 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ update_configs:
ignored_updates:
- match:
dependency_name: "org.jenkins-ci.main:jenkins-core"
- match:
dependency_name: "org.jenkins-ci.main:jenkins-war"
- match:
dependency_name: "org.jenkins-ci.main:jenkins-bom"
- match:
dependency_name: "slf4j-api"
- match:
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ For major changes we usually expect a reference implementation to be provided in

To run and build the repository with integration tests, you can execute

mvn -Prun-plugin-pom-its clean verify
mvn clean verify

## Building and using snapshots

Snapshots might be needed to provide reference implementations for Plugin POM patches.
If you are a plugin maintainer with account on Jenkins artifactory,
you can deploy a Plugin POM snapshot using this command:

mvn clean deploy
mvn clean deploy

Once the snapshot is deployed, you will see a timestamped snapshot version in Maven console output.
Then you can just replace the Plugin POM version in your downstream PRs by this version so that you can demonstrate the build on ci.jenkins.io

Expand All @@ -31,7 +31,7 @@ Then you can just replace the Plugin POM version in your downstream PRs by this
### Managing release notes

* Changelog drafts are automatically by link:https://github.com/toolmantim/release-drafter[Release Drafter]
* See the documentation about Jenkins Release Drafter configuration link:https://github.com/jenkinsci/.github/blob/master/docs/release-drafter.adoc[here]
** See the documentation about Jenkins Release Drafter configuration link:https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc[here]
* When merging pull requests...
** Make sure to modify pull request titles to make them user-friendly
** Set proper labels so the changelog is categorized
Expand Down
30 changes: 8 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '20'))
timeout(time: 1, unit: 'HOURS')
}
agent {
docker {
image 'maven:3.6.0-jdk-8'
label 'docker'
}
}
stages {
stage('main') {
steps {
sh 'mvn -B -Prun-plugin-pom-its clean verify'
}
post {
failure {
catchError { // JENKINS-42478: in case the failure occurred prior to getting the node
archiveArtifacts artifacts: 'target/its/*/build.log', allowEmptyArchive: true
}
}
properties([buildDiscarder(logRotator(numToKeepStr: '20'))])
node('maven') {
checkout scm
timeout(time: 1, unit: 'HOURS') {
// TODO Azure mirror
ansiColor('xterm') {
withEnv(['MAVEN_OPTS=-Djansi.force=true']) {
sh 'mvn -B -Dstyle.color=always -ntp clean verify'
}
}
}
Expand Down
149 changes: 19 additions & 130 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# plugin-pom
Parent POM for Jenkins Plugins
# Parent POM for Jenkins Plugins

[![GitHub release](https://img.shields.io/github/release/jenkinsci/plugin-pom.svg?label=changelog)](https://github.com/jenkinsci/plugin-pom/releases/latest)
[![GitHub license](https://img.shields.io/github/license/jenkinsci/plugin-pom)](https://github.com/jenkinsci/plugin-pom/blob/master/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](https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-bom/))

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:
Expand All @@ -13,12 +17,11 @@ thought to be overridden are no longer based on properties. The main remaining o
See [Java Support](#java-support) for more info.
* `jenkins-test-harness.version`: The [JTH version](https://github.com/jenkinsci/jenkins-test-harness/releases) used to test plugin.
Uses split test-harness (see [JENKINS-32478](https://issues.jenkins-ci.org/browse/JENKINS-32478)).
If the required Jenkins version is 1.580.1 or higher, JTH 2.1+ is recommended.
* `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, `slf4jVersion`, `node.version` and `npm.version`
* 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.
Expand Down Expand Up @@ -58,27 +61,9 @@ If you had a `jar:test-jar` execution, delete it and add to `properties`:

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,
`java.level=8` and `jenkins.version>2.59` are expected to be used for most plugins.

### Using deprecated Java targets

If recent plugin POM versions are required for a plugin with older baselines,
a developer can use dependency version system properties to downgrade components incompatible with Java 7.
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.

Example:

```xml
<properties>
<jenkins.version>2.32.3</jenkins.version>
<java.level>7</java.level>
<!-- Animal Sniffer Annotations 1.18 is not compatible with Java 7 anymore -->
<animal.sniffer.version>1.17</animal.sniffer.version>
</properties>
```

Such mode is no longer tested in the repository,
and the list of incompatible dependencies will expand without further notice in new releases.

## Incrementals

Expand All @@ -90,121 +75,25 @@ See [Incrementals](https://github.com/jenkinsci/incrementals-tools) for details.
To run JMH benchmarks from JUnit tests, you must run you must activate the `benchmark`
profile. For example:
```bash
mvn -Dbenchmark test
mvn -P jmh-benchmark test
```
When the `benchmark` property is set, no tests apart from JMH benchmarks will be run.
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 the word `Benchmark`. For example, `FooBenchmark` and `BenchmarkFoo` will
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](https://github.com/jenkinsci/jenkins-test-harness/blob/master/docs/jmh-benchmarks.adoc)

## Baselines

It is handy to be able to select different Jenkins baselines with a Maven profile.
To set this up, you must edit your `~/.m2/settings.xml` to include some new entries in the `<profiles>` section.
For example:

```xml
<profile>
<id>jenkins-289</id>
<properties>
<jenkins.version>2.89.2</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-273</id>
<properties>
<jenkins.version>2.73.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-260</id>
<properties>
<jenkins.version>2.60.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-246</id>
<properties>
<jenkins.version>2.46.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-232</id>
<properties>
<jenkins.version>2.32.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-219</id>
<properties>
<jenkins.version>2.19.4</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-27</id>
<properties>
<jenkins.version>2.7.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-651</id>
<properties>
<jenkins.version>1.651.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-642</id>
<properties>
<jenkins.version>1.642.4</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-625</id>
<properties>
<jenkins.version>1.625.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-609</id>
<properties>
<jenkins.version>1.609.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-596</id>
<properties>
<jenkins.version>1.596.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-580</id>
<properties>
<jenkins.version>1.580.3</jenkins.version>
</properties>
</profile>
<profile>
<id>jenkins-565</id>
<properties>
<jenkins.version>1.565.3</jenkins.version>
<jenkins-test-harness.version>1.565.3</jenkins-test-harness.version>
</properties>
</profile>
```

Now for example if your plugin normally builds against 1.625.x, but you wish to test compatibility with 1.651.x,
there is no need to edit your POM. Just run:

mvn -Pjenkins-651 clean test

or

mvn -Pjenkins-651 hpi:run

## 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)](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
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](https://jenkins.io/doc/developer/plugin-development/dependency-management/) section of the
[plugin development guide](https://jenkins.io/doc/developer/plugin-development/).
Loading

0 comments on commit 9cd101c

Please sign in to comment.