diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index b0fb063fa8..274f230468 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,6 +1,18 @@
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
version: 2
updates:
-- package-ecosystem: "maven"
- directory: "/"
- schedule:
- interval: "weekly"
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ ignore:
+ # Must remain within Jetty 9.x until Java 8 support is removed
+ - dependency-name: "org.eclipse.jetty:jetty-maven-plugin"
+ versions: [">=10.0.0"]
+ # Requires Java 11 starting with version 1711.v5b_1b_03f0fcf2.
+ - dependency-name: "org.kohsuke.stapler:stapler-groovy"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index c119c69843..5bf31fdc4f 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -1,2 +1,4 @@
+# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+
_extends: .github
tag-template: maven-hpi-plugin-$NEXT_MINOR_VERSION
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
new file mode 100644
index 0000000000..832442dd35
--- /dev/null
+++ b/.github/workflows/release-drafter.yml
@@ -0,0 +1,16 @@
+# Automates creation of Release Drafts using Release Drafter
+# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ # Drafts your next Release notes as Pull Requests are merged into "master"
+ - uses: release-drafter/release-drafter@v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
new file mode 100644
index 0000000000..9ac2968bca
--- /dev/null
+++ b/.mvn/extensions.xml
@@ -0,0 +1,7 @@
+
+
+ io.jenkins.tools.incrementals
+ git-changelist-maven-extension
+ 1.4
+
+
diff --git a/.mvn/maven.config b/.mvn/maven.config
new file mode 100644
index 0000000000..2a0299c486
--- /dev/null
+++ b/.mvn/maven.config
@@ -0,0 +1,2 @@
+-Pconsume-incrementals
+-Pmight-produce-incrementals
diff --git a/Jenkinsfile b/Jenkinsfile
index db5c8363bf..265bf17c44 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,12 +1,43 @@
-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 -Prun-its clean install site'
+properties([
+ buildDiscarder(logRotator(numToKeepStr: '20')),
+ disableConcurrentBuilds(abortPrevious: true)
+])
+
+def runTests(Map params = [:]) {
+ return {
+ def agentContainerLabel = params['jdk'] == 8 ? 'maven' : 'maven-' + params['jdk']
+ boolean publishing = params['jdk'] == 8
+ node(agentContainerLabel) {
+ timeout(time: 1, unit: 'HOURS') {
+ def stageIdentifier = params['platform'] + '-' + params['jdk']
+ stage("Checkout (${stageIdentifier})") {
+ checkout scm
+ }
+ stage("Build (${stageIdentifier})") {
+ ansiColor('xterm') {
+ def args = ['-Dstyle.color=always', '-Prun-its', '-Dmaven.test.failure.ignore', 'clean', 'install', 'site']
+ if (publishing) {
+ args += '-Dset.changelist'
+ }
+ // Needed for correct computation of JenkinsHome in RunMojo#execute.
+ withEnv(['JENKINS_HOME=', 'HUDSON_HOME=']) {
+ infra.runMaven(args, params['jdk'])
}
+ }
+ }
+ stage("Archive (${stageIdentifier})") {
+ junit 'target/invoker-reports/TEST-*.xml'
+ if (publishing) {
+ infra.prepareToPublishIncrementals()
+ }
}
+ }
}
+ }
}
+
+parallel(
+ 'linux-8': runTests(platform: 'linux', jdk: 8),
+ 'linux-11': runTests(platform: 'linux', jdk: 11)
+)
+infra.maybePublishIncrementals()
diff --git a/README.md b/README.md
index f9d002cbe1..600455d9e5 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
Maven plugin to build Jenkins plugins.
See the [developer guide](https://jenkins.io/doc/developer/plugin-development/) for details.
-[Mojo documentation](http://jenkinsci.github.io/maven-hpi-plugin/)
+[Mojo documentation](https://jenkinsci.github.io/maven-hpi-plugin/)
## Changelog
@@ -11,93 +11,9 @@ See the [developer guide](https://jenkins.io/doc/developer/plugin-development/)
See [GitHub Releases](https://github.com/jenkinsci/maven-hpi-plugin/releases)
-### 3.5 (2019-03-28)
+### Older versions
-* Treat POM loading errors in dependencies as nonfatal.
-
-### 3.3 (2019-01-31)
-
-* [JENKINS-54807](https://issues.jenkins-ci.org/browse/JENKINS-54807) -
-Fix classloading of Java-internal modules when running `hpi:run` with Java 11
-
-### 3.2 (2019-01-16)
-
-* [PR #90](https://github.com/jenkinsci/maven-hpi-plugin/pull/90) -
-Introduce a new `hpi.compatibleSinceVersion` property to support
-[marking plugins as incompatible](https://wiki.jenkins.io/display/JENKINS/Marking+a+new+plugin+version+as+incompatible+with+older+versions)
-without the plugin configuration override
- * Prevents issues like [JENKINS-55562](https://issues.jenkins-ci.org/browse/JENKINS-55562)
-* [JENKINS-54949](https://issues.jenkins-ci.org/browse/JENKINS-54949) -
-Add support of adding the current pom.xml to the custom WAR
-in the `hpi:custom-war` mojo
-
-### 3.1 (2018-12-14)
-
-* `hpi:run` was broken since 3.0 since `minimumJavaVersion` was not being properly propagated.
-
-### 3.0 (2018-12-05)
-
-* [JENKINS-20679](https://issues.jenkins-ci.org/browse/JENKINS-20679) -
-Inject `Minimum-Java-Version` into the manifest.
- * It is set by a new mandatory `minimumJavaVersion` parameter in `hpi:hpi`, `hpi:jar` and `hpi:hpl`
- * Format: `java.specification.version` according to [Java JEP-223](https://openjdk.java.net/jeps/223).
- Examples: `1.6`, `1.7`, `1.8`, `6`, `7`, `8`, `9`, `11`, ...
-* [PR #83](https://github.com/jenkinsci/maven-hpi-plugin/pull/83) -
-Improve the error message when an improper JAR file is passed
-* Internal: Move manifest-related parameters and logic to `AbstractJenkinsManifestMojo`
-
-### 2.7 (2018-10-30)
-
-* Delete `work/plugins/*.jpl` where the current `test`-scoped dependency is not in fact a snapshot.
-* Use a more specific temp dir for Jetty.
-
-### 2.6 (2018 Jun 01)
-
-* Bugs in the dependency copy of `mvn hpi:run` could lead to anomalies such as `work/plugins/null.jpi`.
-
-### 2.5 (2018 May 11)
-
-* Option to override a snapshot plugin version with a more informative string.
-
-### 2.3 (2018 Apr 19)
-
-* Using a newer standard `VersionNumber` that precisely matches the behavior of the Jenkins plugin manager.
-
-### 2.2 (2018 Jan 30)
-
-* Fix `mvn clean hpi:run` and some similar special goal sequences.
-
-### 2.1 (2017 Sep 26)
-
-* Jenkins plugin archetypes are no longer bundled with this Maven plugin. Instead use the [new project](https://github.com/jenkinsci/archetypes/blob/master/README.md#introduction).
-* Making `-DwebAppFile=…` work.
-* Fixing unchecked/rawtypes warnings in `InjectedTest`.
-* No more special handling of artifacts with `-ea` in the version.
-
-### 2.0 (2017 May 25)
-
-* Updated integrated Jetty server to 9.x. This means that JDK 8 is now required at build time. (Plugins may continue to target older Java baselines using the `java.level` property in the 2.x parent POM.)
-* [JENKINS-24064](https://issues.jenkins-ci.org/browse/JENKINS-24064) Added `executable-war` artifact type, permitting Jenkins to stop deploying the wasteful `jenkins-war-*-war-for-test.jar` artifact, which was identical to `jenkins-war-*.war`.
-
-### 1.122 (2017 Apr 12)
-
-* Fixed HTML escaping for Javadoc created for taglibs so it can be processed by JDK 8.
-* Logging the current artifact for `InjectedTest`.
-* More fixes to mojos that assumed that plugin artifacts used a short name identical to the `artifactId`.
-* Minor archetype updates.
-
-### 1.121 (2016 Dec 16)
-
-* Fixing a problem with plugin dependency resolution affecting users of jitpack.io.
-
-### 1.120 (2016 Sep 26)
-
-* Allowing `hpi:run` to pick up compiled classes & saved resources from core or plugin snapshot dependencies in addition to the plugin under test itself.
-* Ensuring `Plugin-Dependencies` appears in a consistent order from build to build.
-
-### 1.119 and earlier
-
-Not recorded.
+See [archive](https://github.com/jenkinsci/maven-hpi-plugin/tree/24b27178f4dbdb9eeb395f35fc94774d514c980a#35-2019-03-28).
## For maintainers
diff --git a/pom.xml b/pom.xml
index 832adf4a64..218962a1ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,20 +1,22 @@
+
4.0.0org.jenkins-cijenkins
- 1.62
+ 1.88org.jenkins-ci.toolsmaven-hpi-plugin
- 3.18-SNAPSHOT
+ ${revision}${changelist}maven-pluginMaven Jenkins PluginMaven2 plugin for developing Jenkins plugins
+ https://github.com/jenkinsci/${project.artifactId}The Apache Software License, Version 2.0
@@ -23,15 +25,11 @@
- scm:git:git://github.com/jenkinsci/maven-hpi-plugin.git
- scm:git:ssh://git@github.com/jenkinsci/maven-hpi-plugin.git
- https://github.com/jenkinsci/maven-hpi-plugin
- HEAD
+ scm:git:https://github.com/${gitHubRepo}.git
+ scm:git:git@github.com:${gitHubRepo}.git
+ ${scmTag}
+ https://github.com/${gitHubRepo}
-
- jenkins
- https://buildhive.cloudbees.com/job/jenkinsci/job/maven-hpi-plugin/
- github.com
- gitsite:git@github.com/jenkinsci/maven-hpi-plugin.git
+ gitsite:git@github.com/${gitHubRepo}.git
+ 3.36
+ -SNAPSHOT${${$}}{$}${UTF-8
- 8
-
- 2.5.3
- 2.2.0
- 3.6.0
- true
- true
+ jenkinsci/${project.artifactId}
+ 1.1.0
+ 3.8.6
+ 3.6.4
+ 2.1.1
+ 1.1.0
+ ${project.basedir}/src/spotbugs/spotbugs-excludes.xml
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
+
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+ org.apache.maven
+ maven-artifact
+ ${maven.version}
+
+
+ org.apache.maven
+ maven-core
+ ${maven.version}
+
+
+ org.apache.maven
+ maven-model
+ ${maven.version}
+
+
+ org.apache.maven.shared
+ maven-shared-utils
+ 3.3.4
+
+
+ org.eclipse.aether
+ aether-api
+ ${aether.version}
+
+
+ org.eclipse.aether
+ aether-impl
+ ${aether.version}
+
+
+ org.eclipse.aether
+ aether-spi
+ ${aether.version}
+
+
+ org.eclipse.aether
+ aether-util
+ ${aether.version}
+
+
+
- org.apache.maven.plugin-tools
- maven-plugin-annotations
- ${maven-plugin-tools.version}
-
- provided
+ com.github.spotbugs
+ spotbugs-annotations
+ true
+
+
+ com.google.code.findbugs
+ jsr305
+
+
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+
+
+ com.sun.codemodel
+ codemodel
+ 2.6
+
+
+ io.jenkins.lib
+ support-log-formatter
+ 1.1
+
+
+ net.java.sezpoz
+ sezpoz
+ 1.13
+
+
+ org.apache.ant
+ ant
+ 1.10.12
+
+
+ org.apache.maven
+ maven-archiver
+ 3.6.0
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.3.0
+
+
+ org.apache.maven.shared
+ maven-artifact-transfer
+ 0.13.1
+
+
+ org.apache.maven.shared
+ maven-dependency-tree
+ 3.2.0
+
+
+ org.codehaus.plexus
+ plexus-component-annotations
+ ${plexus-containers.version}
+
+
+ org.codehaus.plexus
+ plexus-interactivity-api
+ 1.1org.codehaus.plexusplexus-utils
- 3.3.0
+ 3.4.2
- com.ibm.icu
- icu4j
- 67.1
-
+ org.eclipse.jetty
+ jetty-maven-plugin
+ 9.4.49.v20220914
- com.sun.codemodel
- codemodel
- 2.6
+ org.jenkins-ci
+ version-number
+ 1.10org.kohsuke.staplerstapler-groovy
- 1.260
+ 1685.v3b_5035c4ce05
- org.apache.maven
- maven-plugin-api
- ${maven.version}
+ org.twdata.maven
+ mojo-executor
+ 2.4.0org.apache.maven
- maven-project
- ${maven.version}
+ maven-artifact
+ providedorg.apache.maven
- maven-archiver
- 2.0.1
+ maven-builder-support
+ ${maven.version}
+ providedorg.apache.maven
- maven-artifact
- ${maven.version}
+ maven-core
+ provided
- org.eclipse.jetty
- jetty-maven-plugin
- 9.4.32.v20200930
+ org.apache.maven
+ maven-model
+ provided
- net.java.sezpoz
- sezpoz
- 1.13
+ org.apache.maven
+ maven-model-builder
+ ${maven.version}
+ provided
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.10
+ org.apache.maven
+ maven-plugin-api
+ ${maven.version}
+ provided
- org.codehaus.plexus
- plexus-interactivity-api
- 1.0
+ org.apache.maven
+ maven-repository-metadata
+ ${maven.version}
+ provided
-
- org.kohsuke.stapler
- maven-stapler-plugin
- 1.17
-
-
-
- javax.servlet
- servlet-api
-
-
+ org.apache.maven
+ maven-resolver-provider
+ ${maven.version}
+ provided
- org.codehaus.plexus
- plexus-component-annotations
- 2.1.0
+ org.apache.maven
+ maven-settings
+ ${maven.version}
+ provided
- org.jenkins-ci
- version-number
- 1.7
+ org.apache.maven
+ maven-settings-builder
+ ${maven.version}
+ provided
- io.jenkins.lib
- support-log-formatter
- 1.0
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${maven-plugin-tools.version}
+
+ provided
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
org.apache.maven.pluginsmaven-site-plugin
- 3.9.1com.github.stephenc.wagonwagon-gitsite0.5
-
- org.apache.velocity
- velocity
- 1.5
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
- [1.3,)
-
- run
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-plugin-plugin
- ${maven-plugin-tools.version}
-
- hpi
- true
-
-
+ maven-enforcer-plugin
- mojo-descriptor
-
- descriptor
-
-
-
- help-goal
-
- helpmojo
-
+ display-info
+
+
+
+
+ commons-io:commons-io
+ commons-lang:commons-lang
+ org.apache.commons:commons-compress
+ org.apache.maven.wagon:wagon-provider-api
+ org.codehaus.plexus:plexus-container-default
+ org.eclipse.sisu:org.eclipse.sisu.plexus
+ org.ow2.asm:asm
+ org.slf4j:slf4j-api
+
+
+
+
+ [1.8.0,]
+
+
+ 1.8
+
+
+
-
- org.codehaus.mojo
- mrm-maven-plugin
- 1.2.0
-
- repository.proxy.url
-
-
-
-
- org.apache.maven.pluginsmaven-invoker-plugin
- 3.2.1
+ 3.3.0src/it${project.build.directory}/its${basedir}/target/local-reposrc/it/settings.xml
- true
- true*/pom.xml
@@ -276,40 +348,51 @@
${repository.proxy.url}
+
+
+
+
- org.codehaus.mojo
- animal-sniffer-maven-plugin
- 1.19
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ ${maven-plugin-tools.version}
+
+ hpi
+ true
+
+
+ help-goal
- check
+ helpmojo
+
+
+
+ mojo-descriptor
+
+ descriptor
-
-
- org.codehaus.mojo.signature
- java1${java.level}
- 1.0
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
+ org.codehaus.mojo
+ mrm-maven-plugin
+ 1.4.1
- 1.${java.level}
- 1.${java.level}
+ repository.proxy.url
+
+
+ org.codehaus.plexusplexus-component-metadata
- 2.1.0
+ ${plexus-containers.version}
@@ -323,7 +406,7 @@
org.apache.maven.wagonwagon-ssh
- 3.4.1
+ 3.5.3
@@ -344,37 +427,106 @@
- org.codehaus.mojo
- mrm-maven-plugin
+ maven-invoker-plugin
+ integration-test
- start
- stop
+ install
+ run
- maven-invoker-plugin
+ org.codehaus.mojo
+ mrm-maven-plugin
- integration-test
- install
- run
+ start
+ stop
-
- true
-
-
-
-
+
+ all-tests
+
+
+ !invoker.test
+
+
+
+ true
+ io.jenkins.tools.maven_hpi_plugin.its
+
+
+
+ specific-tests
+
+
+ invoker.test
+
+
+
+ true
+
+
+
+
+ jdk-8-and-below
+
+ (,1.8]
+
+
+
+
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+ 1.8
+ 1.8
+
+
+
+
+
+ maven-javadoc-plugin
+
+ 1.8
+
+
+
+
+
+
+
+ jdk-9-and-above
+
+ [9,)
+
+
+
+
+ maven-compiler-plugin
+
+ 8
+ 8
+
+
+
+ maven-javadoc-plugin
+
+ 8
+
+
+
+
+
diff --git a/src/it/JENKINS-45740-metadata/invoker.properties b/src/it/JENKINS-45740-metadata/invoker.properties
index ccb70fca53..7335f6c9fa 100644
--- a/src/it/JENKINS-45740-metadata/invoker.properties
+++ b/src/it/JENKINS-45740-metadata/invoker.properties
@@ -1,3 +1,3 @@
# install, not verify, because we want to check the artifact as we would be about to deploy it
# release.skipTests normally set in jenkins-release profile since release:perform would do the tests
-invoker.goals=-Dstyle.color=always -ntp -Pjenkins-release -Drelease.skipTests=false clean install
+invoker.goals=-ntp -Pjenkins-release -Drelease.skipTests=false clean install
diff --git a/src/it/JENKINS-45740-metadata/pom.xml b/src/it/JENKINS-45740-metadata/pom.xml
index a0575a897f..1628e756ff 100644
--- a/src/it/JENKINS-45740-metadata/pom.xml
+++ b/src/it/JENKINS-45740-metadata/pom.xml
@@ -5,14 +5,15 @@
org.jenkins-ci.pluginsplugin
- 3.47
+ 4.40
+ org.jenkins-ci.tools.hpi.itsJENKINS-45740-metadata1.0-SNAPSHOThpi
- 8
+ 2.249.1@project.version@https://github.com/jenkinsci/configuration-as-code-plugin/releases
@@ -20,16 +21,16 @@
-
- MIT License
- https://opensource.org/licenses/MIT
- repo
-
-
- MY License
- https://mylicense.txt
- Hello, world!
-
+
+ MIT License
+ https://opensource.org/licenses/MIT
+ repo
+
+
+ MY License
+ https://mylicense.txt
+ Hello, world!
+
@@ -46,9 +47,9 @@
- scm:git:git://github.com/jenkinsci/${project.artifctId}-plugin.git
- scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git
- https://github.com/jenkinsci/${project.artifactId}-plugin
- HEAD
+ scm:git:https://github.com/jenkinsci/maven-hpi-plugin.git
+ scm:git:git@github.com:jenkinsci/maven-hpi-plugin.git
+ https://github.com/jenkinsci/${project.artifactId}-plugin
+ HEAD
diff --git a/src/it/JENKINS-58771-packaged-plugins-2/invoker.properties b/src/it/JENKINS-58771-packaged-plugins-2/invoker.properties
index de21ce6dfe..a5788e324f 100644
--- a/src/it/JENKINS-58771-packaged-plugins-2/invoker.properties
+++ b/src/it/JENKINS-58771-packaged-plugins-2/invoker.properties
@@ -1 +1 @@
-invoker.goals=-Dstyle.color=always -ntp clean install
+invoker.goals=-ntp clean install
diff --git a/src/it/JENKINS-58771-packaged-plugins-2/pom.xml b/src/it/JENKINS-58771-packaged-plugins-2/pom.xml
index d4b21ebd50..14dcb7c29b 100644
--- a/src/it/JENKINS-58771-packaged-plugins-2/pom.xml
+++ b/src/it/JENKINS-58771-packaged-plugins-2/pom.xml
@@ -5,15 +5,15 @@
org.jenkins-ci.pluginsplugin
- 3.57
+ 4.40
+ org.jenkins-ci.tools.hpi.itsJENKINS-58771-packaged-plugins1.0-SNAPSHOThpi
- 8
- 2.176.1
+ 2.249.1@project.version@
@@ -40,21 +40,42 @@
org.jenkins-ci.plugins.workflowworkflow-cps
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
org.jenkins-ci.plugins.workflowworkflow-supportteststest
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -62,8 +83,8 @@
io.jenkins.tools.bom
- bom-2.176.x
- 5
+ bom-2.249.x
+ 984.vb5eaac999a7eimportpom
diff --git a/src/it/JENKINS-58771-packaged-plugins-3/invoker.properties b/src/it/JENKINS-58771-packaged-plugins-3/invoker.properties
index de21ce6dfe..a5788e324f 100644
--- a/src/it/JENKINS-58771-packaged-plugins-3/invoker.properties
+++ b/src/it/JENKINS-58771-packaged-plugins-3/invoker.properties
@@ -1 +1 @@
-invoker.goals=-Dstyle.color=always -ntp clean install
+invoker.goals=-ntp clean install
diff --git a/src/it/JENKINS-58771-packaged-plugins-3/pom.xml b/src/it/JENKINS-58771-packaged-plugins-3/pom.xml
index 79df6294d0..a562ee85e4 100644
--- a/src/it/JENKINS-58771-packaged-plugins-3/pom.xml
+++ b/src/it/JENKINS-58771-packaged-plugins-3/pom.xml
@@ -6,15 +6,17 @@
org.jenkins-ci.pluginsplugin3.57
+ org.jenkins-ci.tools.hpi.itsJENKINS-58771-packaged-plugins1.0-SNAPSHOThpi
+ 2.249.18
- 2.176.1@project.version@
+ true
@@ -41,7 +43,7 @@
org.jenkins-ci.pluginsgoogle-oauth-plugin
- 0.8
+ 0.10
@@ -49,16 +51,11 @@
io.jenkins.tools.bom
- bom-2.176.x
- 5
+ bom-2.249.x
+ 984.vb5eaac999a7eimportpom
-
- commons-io
- commons-io
- 2.6
-
diff --git a/src/it/JENKINS-58771-packaged-plugins/invoker.properties b/src/it/JENKINS-58771-packaged-plugins/invoker.properties
index de21ce6dfe..a5788e324f 100644
--- a/src/it/JENKINS-58771-packaged-plugins/invoker.properties
+++ b/src/it/JENKINS-58771-packaged-plugins/invoker.properties
@@ -1 +1 @@
-invoker.goals=-Dstyle.color=always -ntp clean install
+invoker.goals=-ntp clean install
diff --git a/src/it/JENKINS-58771-packaged-plugins/pom.xml b/src/it/JENKINS-58771-packaged-plugins/pom.xml
index 0de87c88fc..08c2c179c6 100644
--- a/src/it/JENKINS-58771-packaged-plugins/pom.xml
+++ b/src/it/JENKINS-58771-packaged-plugins/pom.xml
@@ -5,15 +5,15 @@
org.jenkins-ci.pluginsplugin
- 3.47
+ 4.40
+ org.jenkins-ci.tools.hpi.itsJENKINS-58771-packaged-plugins1.0-SNAPSHOThpi
- 8
- 2.176.1
+ 2.249.1@project.version@
@@ -34,13 +34,11 @@
org.jenkins-ci.pluginsgit
- 3.11.0testorg.jenkinsci.pluginspipeline-model-extensions
- 1.3.7
@@ -48,8 +46,8 @@
io.jenkins.tools.bom
- bom
- 2.176.2
+ bom-2.249.x
+ 984.vb5eaac999a7eimportpom
diff --git a/src/it/assemble-dependencies-as-jpi/invoker.properties b/src/it/assemble-dependencies-as-jpi/invoker.properties
index 1aa153b3a9..9295005f6b 100644
--- a/src/it/assemble-dependencies-as-jpi/invoker.properties
+++ b/src/it/assemble-dependencies-as-jpi/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean generate-resources
+invoker.goals=-ntp clean generate-resources
diff --git a/src/it/assemble-dependencies-as-jpi/pom.xml b/src/it/assemble-dependencies-as-jpi/pom.xml
index 758279afda..85eff1d330 100644
--- a/src/it/assemble-dependencies-as-jpi/pom.xml
+++ b/src/it/assemble-dependencies-as-jpi/pom.xml
@@ -1,19 +1,42 @@
+
4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
org.jenkins-ci.tools.hpi.itsbundle-it1.0-SNAPSHOTpom
+
+ 2.249.1
+ @project.version@
+
+
+
+
+
+ org.jenkins-ci
+ symbol-annotation
+ 1.7
+
+
+
+
org.jenkins-ci.pluginsssh-credentials
- 1.10
+ 1.18.1
@@ -23,7 +46,6 @@
@project.groupId@@project.artifactId@
- @project.version@generate-resources
diff --git a/src/it/assemble-dependencies/invoker.properties b/src/it/assemble-dependencies/invoker.properties
index 1aa153b3a9..9295005f6b 100644
--- a/src/it/assemble-dependencies/invoker.properties
+++ b/src/it/assemble-dependencies/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean generate-resources
+invoker.goals=-ntp clean generate-resources
diff --git a/src/it/assemble-dependencies/pom.xml b/src/it/assemble-dependencies/pom.xml
index 757f1f880b..caa95e0259 100644
--- a/src/it/assemble-dependencies/pom.xml
+++ b/src/it/assemble-dependencies/pom.xml
@@ -1,19 +1,42 @@
+
4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
org.jenkins-ci.tools.hpi.itsbundle-it1.0-SNAPSHOTpom
+
+ 2.249.1
+ @project.version@
+
+
+
+
+
+ org.jenkins-ci
+ symbol-annotation
+ 1.7
+
+
+
+
org.jenkins-ci.pluginsssh-credentials
- 1.10
+ 1.18.1
@@ -23,7 +46,6 @@
@project.groupId@@project.artifactId@
- @project.version@generate-resources
diff --git a/src/it/bad-bundle/pom.xml b/src/it/bad-bundle/pom.xml
deleted file mode 100644
index 42c9b76420..0000000000
--- a/src/it/bad-bundle/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- 4.0.0
-
- org.jenkins-ci.tools.hpi.its
- bundle-it
- 1.0-SNAPSHOT
-
- pom
-
-
-
- org.jenkins-ci.plugins
- ssh-credentials
- 1.10
-
-
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- generate-resources
-
- bundle-plugins
-
-
-
-
-
-
-
-
diff --git a/src/it/bundle-fails-optional-conflict/pom.xml b/src/it/bundle-fails-optional-conflict/pom.xml
deleted file mode 100644
index c9580d6b57..0000000000
--- a/src/it/bundle-fails-optional-conflict/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- 4.0.0
-
- org.jenkins-ci.tools.hpi.its
- bundle-it
- 1.0-SNAPSHOT
-
- pom
-
-
-
- org.jenkins-ci.plugins
- parameterized-trigger
- 2.26
- hpi
- true
-
-
- org.jenkins-ci.plugins
- matrix-project
- 1.2
- hpi
-
-
-
-
- ${project.artifactId}
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- generate-resources
-
- bundle-plugins
-
-
-
-
-
-
-
-
diff --git a/src/it/bundle-with-optional-deps/pom.xml b/src/it/bundle-with-optional-deps/pom.xml
deleted file mode 100644
index 1226e36363..0000000000
--- a/src/it/bundle-with-optional-deps/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
- 4.0.0
-
- org.jenkins-ci.tools.hpi.its
- bundle-it
- 1.0-SNAPSHOT
-
- pom
-
-
-
- org.jenkins-ci.plugins
- ssh-credentials
- 1.10
- hpi
-
-
- org.jenkins-ci.plugins
- ssh-slaves
- 1.6
- hpi
- true
-
-
- org.jenkins-ci.plugins
- support-core
- 2.18
- hpi
- true
-
-
-
-
-
- ${project.artifactId}
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- generate-resources
-
- bundle-plugins
-
-
-
-
-
-
-
-
diff --git a/src/it/bundle-with-optional-deps/verify.groovy b/src/it/bundle-with-optional-deps/verify.groovy
deleted file mode 100644
index ee90cbba1e..0000000000
--- a/src/it/bundle-with-optional-deps/verify.groovy
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-assert new File(basedir, 'target/bundle-it/WEB-INF/plugins/ssh-credentials.hpi').exists();
-assert new File(basedir, 'target/bundle-it/WEB-INF/plugins/credentials.hpi').exists();
-assert new File(basedir, 'target/bundle-it/WEB-INF/optional-plugins/ssh-slaves.hpi').exists();
-assert new File(basedir, 'target/bundle-it/WEB-INF/optional-plugins/support-core.hpi').exists();
-assert new File(basedir, 'target/bundle-it/WEB-INF/optional-plugins/metrics.hpi').exists();
-
-String manifest = new File(basedir, 'target/plugin-manifest.txt').text
-
-assert manifest =~ /ssh-credentials\s+1\.10/ : "direct non-optional dependency on ssh-credentials"
-assert manifest =~ /credentials\s+1\.16\.1/ : "transitive non-optional dependency of ssh-credentials"
-assert manifest =~ /ssh-slaves\s+1\.6/ : "direct optional dependency on ssh-slaves"
-assert ! (manifest =~ /credentials\s+1\.9\.4/) : "don't pull in the transitive dependency from ssh-slaves as already pulled in"
-assert manifest =~ /support-core\s+2\.18/ : "direct optional dependency on support-core"
-assert manifest =~ /metrics\s+3\.0\.0/ : "transitive optional dependency on metrics"
-
-return true;
diff --git a/src/it/check-core-version-failure/invoker.properties b/src/it/check-core-version-failure/invoker.properties
index cc8c3232ee..871413e046 100644
--- a/src/it/check-core-version-failure/invoker.properties
+++ b/src/it/check-core-version-failure/invoker.properties
@@ -17,5 +17,5 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp validate
+invoker.goals=-ntp validate
invoker.buildResult = failure
diff --git a/src/it/check-core-version-failure/pom.xml b/src/it/check-core-version-failure/pom.xml
index b4d4a75024..f6a2c27129 100644
--- a/src/it/check-core-version-failure/pom.xml
+++ b/src/it/check-core-version-failure/pom.xml
@@ -5,38 +5,27 @@
org.jenkins-ci.pluginsplugin
- 4.6
+ 4.40check-core-version-failure1.0-SNAPSHOThpi
- 8
- 2.204
+ 2.249.1
+ @project.version@org.jenkins-ci.pluginsjackson2-api
- 2.11.2
+ 2.13.2-260.v43d711474c77io.jenkinsconfiguration-as-code
- 1.36
+ 1414.v878271fc496ftest
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
-
-
diff --git a/src/it/check-core-version-failure/verify.groovy b/src/it/check-core-version-failure/verify.groovy
index b26d6be85b..dbea516cf1 100644
--- a/src/it/check-core-version-failure/verify.groovy
+++ b/src/it/check-core-version-failure/verify.groovy
@@ -17,6 +17,6 @@
* under the License.
*/
-assert new File(basedir, 'build.log').getText('UTF-8').contains("Dependency org.jenkins-ci.plugins:jackson2-api:jar:2.11.2 requires Jenkins 2.222.4 or higher.")
+assert new File(basedir, 'build.log').getText('UTF-8').contains("Dependency io.jenkins:configuration-as-code:jar:1414.v878271fc496f requires Jenkins 2.289.3 or higher.")
return true;
diff --git a/src/it/check-core-version-success/invoker.properties b/src/it/check-core-version-success/invoker.properties
index ecb1c83ea4..ea9aa6b6b3 100644
--- a/src/it/check-core-version-success/invoker.properties
+++ b/src/it/check-core-version-success/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp validate
+invoker.goals=-ntp validate
diff --git a/src/it/check-core-version-success/pom.xml b/src/it/check-core-version-success/pom.xml
index 1844377200..c5abff179f 100644
--- a/src/it/check-core-version-success/pom.xml
+++ b/src/it/check-core-version-success/pom.xml
@@ -5,32 +5,21 @@
org.jenkins-ci.pluginsplugin
- 4.6
+ 4.40check-core-version-success1.0-SNAPSHOThpi
- 8
- 2.222.4
+ 2.249.1
+ @project.version@org.jenkins-ci.pluginsjackson2-api
- 2.11.2
+ 2.13.2-260.v43d711474c77
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
-
-
diff --git a/src/it/compile-fork-it/invoker.properties b/src/it/compile-fork-it/invoker.properties
index 1f11d01bf9..b36692a49f 100644
--- a/src/it/compile-fork-it/invoker.properties
+++ b/src/it/compile-fork-it/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean compile
+invoker.goals=-ntp clean compile
diff --git a/src/it/compile-fork-it/pom.xml b/src/it/compile-fork-it/pom.xml
index 66e7dfcc31..071190f8f1 100644
--- a/src/it/compile-fork-it/pom.xml
+++ b/src/it/compile-fork-it/pom.xml
@@ -1,44 +1,36 @@
+
-
- 4.0.0
+
+ 4.0.0org.jenkins-ci.pluginsplugin
- 1.424
+ 4.40
+
- org.jenkins-ci.tools.hpi.its
- compile-it
- 1.0-SNAPSHOT
+ org.jenkins-ci.tools.hpi.its
+ compile-it
+ 1.0-SNAPSHOT
+
+ hpi
- hpi
+ MyNewPlugin
- MyNewPlugin
+
+ 2.249.1
+ @project.version@
+
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
- true
-
-
-
- org.kohsuke
- access-modifier-checker
- 1.0
-
-
- @project.groupId@@project.artifactId@
- @project.version@
+
+ true
+
diff --git a/src/it/compile-it/invoker.properties b/src/it/compile-it/invoker.properties
index 1f11d01bf9..b36692a49f 100644
--- a/src/it/compile-it/invoker.properties
+++ b/src/it/compile-it/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean compile
+invoker.goals=-ntp clean compile
diff --git a/src/it/compile-it/pom.xml b/src/it/compile-it/pom.xml
index 6310a19489..7ec95ff8cb 100644
--- a/src/it/compile-it/pom.xml
+++ b/src/it/compile-it/pom.xml
@@ -1,12 +1,14 @@
+
4.0.0
-
- org.jenkins-ci.plugins
- plugin
- 1.424
-
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ org.jenkins-ci.tools.hpi.itscompile-it
@@ -16,28 +18,8 @@
MyNewPlugin
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- org.kohsuke
- access-modifier-checker
- 1.0
-
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
-
-
+
+ 2.249.1
+ @project.version@
+
diff --git a/src/it/bundle-with-optional-deps/invoker.properties b/src/it/compile-multimodule-it/invoker.properties
similarity index 92%
rename from src/it/bundle-with-optional-deps/invoker.properties
rename to src/it/compile-multimodule-it/invoker.properties
index 1aa153b3a9..b36692a49f 100644
--- a/src/it/bundle-with-optional-deps/invoker.properties
+++ b/src/it/compile-multimodule-it/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean generate-resources
+invoker.goals=-ntp clean compile
diff --git a/src/it/compile-multimodule-it/plugin1/pom.xml b/src/it/compile-multimodule-it/plugin1/pom.xml
new file mode 100644
index 0000000000..800383cb92
--- /dev/null
+++ b/src/it/compile-multimodule-it/plugin1/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ 4.0.0
+
+
+ org.jenkins-ci.tools.hpi.its
+ compile-multimodule-it-parent
+ 1.0-SNAPSHOT
+
+
+ compile-multimodule-it-plugin1
+ 1.0-SNAPSHOT
+ hpi
+
diff --git a/src/it/compile-multimodule-it/plugin2/pom.xml b/src/it/compile-multimodule-it/plugin2/pom.xml
new file mode 100644
index 0000000000..d83c6d0982
--- /dev/null
+++ b/src/it/compile-multimodule-it/plugin2/pom.xml
@@ -0,0 +1,22 @@
+
+
+
+ 4.0.0
+
+
+ org.jenkins-ci.tools.hpi.its
+ compile-multimodule-it-parent
+ 1.0-SNAPSHOT
+
+
+ compile-multimodule-it-plugin2
+ hpi
+
+
+
+ ${project.groupId}
+ compile-multimodule-it-plugin1
+ ${project.version}
+
+
+
diff --git a/src/it/compile-multimodule-it/pom.xml b/src/it/compile-multimodule-it/pom.xml
new file mode 100644
index 0000000000..0aa8e84eb7
--- /dev/null
+++ b/src/it/compile-multimodule-it/pom.xml
@@ -0,0 +1,27 @@
+
+
+
+ 4.0.0
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+
+ org.jenkins-ci.tools.hpi.its
+ compile-multimodule-it-parent
+ 1.0-SNAPSHOT
+
+ pom
+
+ 2.249.1
+ @project.version@
+
+
+
+ plugin1
+ plugin2
+
+
diff --git a/src/it/bad-bundle/invoker.properties b/src/it/java-level/invoker.properties
similarity index 89%
rename from src/it/bad-bundle/invoker.properties
rename to src/it/java-level/invoker.properties
index d49748eb4a..9b17b269c5 100644
--- a/src/it/bad-bundle/invoker.properties
+++ b/src/it/java-level/invoker.properties
@@ -17,5 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean generate-resources
-invoker.buildResult = failure
+invoker.goals=-ntp clean verify
diff --git a/src/it/java-level/pom.xml b/src/it/java-level/pom.xml
new file mode 100644
index 0000000000..1ad49b1a6f
--- /dev/null
+++ b/src/it/java-level/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ org.jenkins-ci.tools.hpi.its
+ java-level
+ 1.0-SNAPSHOT
+ hpi
+ MyNewPlugin
+
+ 2.249.1
+ 8
+ @project.version@
+
+
diff --git a/src/it/java-level/src/main/java/org/jenkinsci/tools/hpi/its/X.java b/src/it/java-level/src/main/java/org/jenkinsci/tools/hpi/its/X.java
new file mode 100644
index 0000000000..a39719b66a
--- /dev/null
+++ b/src/it/java-level/src/main/java/org/jenkinsci/tools/hpi/its/X.java
@@ -0,0 +1,2 @@
+package org.jenkinsci.tools.hpi.its;
+public class X {}
diff --git a/src/it/java-level/src/main/resources/index.jelly b/src/it/java-level/src/main/resources/index.jelly
new file mode 100644
index 0000000000..2f655e510a
--- /dev/null
+++ b/src/it/java-level/src/main/resources/index.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/it/java-level/verify.groovy b/src/it/java-level/verify.groovy
new file mode 100644
index 0000000000..425b87cc1b
--- /dev/null
+++ b/src/it/java-level/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+assert new File(basedir, 'build.log').getText('UTF-8').contains("Ignoring deprecated java.level property. This property should be removed from your plugin's POM. In the future this warning will be changed to an error and will break the build.")
+
+return true
diff --git a/src/it/bundle-fails-optional-conflict/invoker.properties b/src/it/jenkins-version/invoker.properties
similarity index 89%
rename from src/it/bundle-fails-optional-conflict/invoker.properties
rename to src/it/jenkins-version/invoker.properties
index d49748eb4a..a1c7c93753 100644
--- a/src/it/bundle-fails-optional-conflict/invoker.properties
+++ b/src/it/jenkins-version/invoker.properties
@@ -17,5 +17,5 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean generate-resources
-invoker.buildResult = failure
+invoker.goals=-ntp clean package
+invoker.buildResult=failure
diff --git a/src/it/jenkins-version/pom.xml b/src/it/jenkins-version/pom.xml
new file mode 100644
index 0000000000..979fad605e
--- /dev/null
+++ b/src/it/jenkins-version/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 3.57
+
+
+ org.jenkins-ci.tools.hpi.its
+ jenkins-version
+ 1.0-SNAPSHOT
+ hpi
+ MyNewPlugin
+
+ 2.200
+ 8
+ @project.version@
+
+
diff --git a/src/it/jenkins-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java b/src/it/jenkins-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java
new file mode 100644
index 0000000000..a39719b66a
--- /dev/null
+++ b/src/it/jenkins-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java
@@ -0,0 +1,2 @@
+package org.jenkinsci.tools.hpi.its;
+public class X {}
diff --git a/src/it/jenkins-version/src/main/resources/index.jelly b/src/it/jenkins-version/src/main/resources/index.jelly
new file mode 100644
index 0000000000..2f655e510a
--- /dev/null
+++ b/src/it/jenkins-version/src/main/resources/index.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/it/jenkins-version/verify.groovy b/src/it/jenkins-version/verify.groovy
new file mode 100644
index 0000000000..c5c0a5176d
--- /dev/null
+++ b/src/it/jenkins-version/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+assert new File(basedir, 'build.log').getText('UTF-8').contains('This version of maven-hpi-plugin requires Jenkins 2.204 or later')
+
+return true
diff --git a/src/it/minimum-java-version/invoker.properties b/src/it/minimum-java-version/invoker.properties
new file mode 100644
index 0000000000..2208ccc2de
--- /dev/null
+++ b/src/it/minimum-java-version/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=-ntp clean verify
diff --git a/src/it/minimum-java-version/pom.xml b/src/it/minimum-java-version/pom.xml
new file mode 100644
index 0000000000..32ac09971b
--- /dev/null
+++ b/src/it/minimum-java-version/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ org.jenkins-ci.tools.hpi.its
+ minimum-java-version
+ 1.0-SNAPSHOT
+ hpi
+ MyNewPlugin
+
+ 2.249.1
+ @project.version@
+
+
+
+
+ org.jenkins-ci.tools
+ maven-hpi-plugin
+
+ 8
+
+
+
+
+
diff --git a/src/it/minimum-java-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java b/src/it/minimum-java-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java
new file mode 100644
index 0000000000..a39719b66a
--- /dev/null
+++ b/src/it/minimum-java-version/src/main/java/org/jenkinsci/tools/hpi/its/X.java
@@ -0,0 +1,2 @@
+package org.jenkinsci.tools.hpi.its;
+public class X {}
diff --git a/src/it/minimum-java-version/src/main/resources/index.jelly b/src/it/minimum-java-version/src/main/resources/index.jelly
new file mode 100644
index 0000000000..2f655e510a
--- /dev/null
+++ b/src/it/minimum-java-version/src/main/resources/index.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/it/minimum-java-version/verify.groovy b/src/it/minimum-java-version/verify.groovy
new file mode 100644
index 0000000000..7269bf3af5
--- /dev/null
+++ b/src/it/minimum-java-version/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+assert new File(basedir, 'build.log').getText('UTF-8').contains("Ignoring deprecated minimumJavaVersion parameter. This property should be removed from your plugin's POM. In the future this warning will be changed to an error and will break the build.")
+
+return true
diff --git a/src/it/missing-index/invoker.properties b/src/it/missing-index/invoker.properties
new file mode 100644
index 0000000000..a1c7c93753
--- /dev/null
+++ b/src/it/missing-index/invoker.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+invoker.goals=-ntp clean package
+invoker.buildResult=failure
diff --git a/src/it/missing-index/pom.xml b/src/it/missing-index/pom.xml
new file mode 100644
index 0000000000..411917fe15
--- /dev/null
+++ b/src/it/missing-index/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ org.jenkins-ci.tools.hpi.its
+ missing-index
+ 1.0-SNAPSHOT
+ hpi
+ MyNewPlugin
+ Deprecated spot for plugin description.
+
+ 2.249.1
+ @project.version@
+
+
diff --git a/src/it/missing-index/src/main/java/org/jenkinsci/tools/hpi/its/X.java b/src/it/missing-index/src/main/java/org/jenkinsci/tools/hpi/its/X.java
new file mode 100644
index 0000000000..a39719b66a
--- /dev/null
+++ b/src/it/missing-index/src/main/java/org/jenkinsci/tools/hpi/its/X.java
@@ -0,0 +1,2 @@
+package org.jenkinsci.tools.hpi.its;
+public class X {}
diff --git a/src/it/missing-index/verify.groovy b/src/it/missing-index/verify.groovy
new file mode 100644
index 0000000000..767a1ca96c
--- /dev/null
+++ b/src/it/missing-index/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+assert new File(basedir, 'build.log').getText('UTF-8').contains("create src/main/resources/index.jelly:");
+
+return true;
diff --git a/src/it/override-test-dependencies-release-failure/invoker.properties b/src/it/override-test-dependencies-release-failure/invoker.properties
new file mode 100644
index 0000000000..536d500ccb
--- /dev/null
+++ b/src/it/override-test-dependencies-release-failure/invoker.properties
@@ -0,0 +1,2 @@
+invoker.goals=-ntp -DoverrideVersions=org.jenkins-ci.plugins.workflow:workflow-step-api:2.11 deploy
+invoker.buildResult = failure
diff --git a/src/it/override-test-dependencies-release-failure/pom.xml b/src/it/override-test-dependencies-release-failure/pom.xml
new file mode 100644
index 0000000000..a6f7654a7d
--- /dev/null
+++ b/src/it/override-test-dependencies-release-failure/pom.xml
@@ -0,0 +1,25 @@
+
+
+ 4.0.0
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ check-core-version-failure
+ 1.0-SNAPSHOT
+ hpi
+
+ 2.249.1
+ @project.version@
+
+
+
+ org.jenkins-ci.plugins
+ jackson2-api
+ 2.13.2-260.v43d711474c77
+
+
+
diff --git a/src/it/override-test-dependencies-release-failure/src/main/java/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.java b/src/it/override-test-dependencies-release-failure/src/main/java/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.java
new file mode 100644
index 0000000000..75555635d5
--- /dev/null
+++ b/src/it/override-test-dependencies-release-failure/src/main/java/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.java
@@ -0,0 +1,144 @@
+package org.jenkinsci.tools.hpi.its;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import hudson.Launcher;
+import hudson.Extension;
+import hudson.util.FormValidation;
+import hudson.model.AbstractBuild;
+import hudson.model.BuildListener;
+import hudson.model.AbstractProject;
+import hudson.tasks.Builder;
+import hudson.tasks.BuildStepDescriptor;
+import java.lang.RuntimeException;
+import net.sf.json.JSONObject;
+import org.kohsuke.stapler.DataBoundConstructor;
+import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.QueryParameter;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * Sample {@link Builder}.
+ *
+ *
+ * When the user configures the project and enables this builder,
+ * {@link org.jenkins.HelloWorldBuilder.DescriptorImpl#newInstance(StaplerRequest)} is invoked
+ * and a new {@link org.jenkins.HelloWorldBuilder} is created. The created
+ * instance is persisted to the project configuration XML by using
+ * XStream, so this allows you to use instance fields (like {@link #name})
+ * to remember the configuration.
+ *
+ *
+ * When a build is performed, the {@link #perform(AbstractBuild, Launcher, BuildListener)} method
+ * will be invoked.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class HelloWorldBuilder extends Builder {
+
+ private final String name;
+
+ // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
+ @DataBoundConstructor
+ public HelloWorldBuilder(String name) {
+ this.name = name;
+ }
+
+ /**
+ * We'll use this from the {@code config.jelly}.
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
+ // this is where you 'build' the project
+ // since this is a dummy, we just say 'hello world' and call that a build
+
+ // this also shows how you can consult the global configuration of the builder
+ if (getDescriptor().useFrench())
+ listener.getLogger().println("Bonjour, " + name + "!");
+ else
+ listener.getLogger().println("Hello, " + name + "!");
+ return true;
+ }
+
+ // overrided for better type safety.
+ // if your plugin doesn't really define any property on Descriptor,
+ // you don't have to do this.
+ @Override
+ public DescriptorImpl getDescriptor() {
+ return (DescriptorImpl) super.getDescriptor();
+ }
+
+ /**
+ * Descriptor for {@link org.jenkins.HelloWorldBuilder}. Used as a singleton.
+ * The class is marked as public so that it can be accessed from views.
+ *
+ *
+ * See {@code views/hudson/plugins/hello_world/HelloWorldBuilder/*.jelly}
+ * for the actual HTML fragment for the configuration screen.
+ */
+ @Extension // this marker indicates Hudson that this is an implementation of an extension point.
+ public static final class DescriptorImpl extends BuildStepDescriptor {
+ /**
+ * To persist global configuration information,
+ * simply store it in a field and call save().
+ *
+ *
+ * If you don't want fields to be persisted, use {@code transient}.
+ */
+ private boolean useFrench;
+
+ /**
+ * Performs on-the-fly validation of the form field 'name'.
+ *
+ * @param value This parameter receives the value that the user has typed.
+ * @return Indicates the outcome of the validation. This is sent to the browser.
+ */
+ public FormValidation doCheckName(@QueryParameter String value) throws IOException, ServletException {
+ if (value.length() == 0)
+ return FormValidation.error("Please set a name");
+ if (value.length() < 4)
+ return FormValidation.warning("Isn't the name too short?");
+ return FormValidation.ok();
+ }
+
+ public boolean isApplicable(Class extends AbstractProject> aClass) {
+ // indicates that this builder can be used with all kinds of project types
+ return true;
+ }
+
+ /**
+ * This human readable name is used in the configuration screen.
+ */
+ public String getDisplayName() {
+ try {
+ return new ObjectMapper().writeValueAsString("Say hello world");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
+ // To persist global configuration information,
+ // set that to properties and call save().
+ useFrench = formData.getBoolean("useFrench");
+ // ^Can also use req.bindJSON(this, formData);
+ // (easier when there are many fields; need set* methods for this, like setUseFrench)
+ save();
+ return super.configure(req, formData);
+ }
+
+ /**
+ * This method returns true if the global configuration says we should speak French.
+ */
+ public boolean useFrench() {
+ return useFrench;
+ }
+ }
+}
+
diff --git a/src/it/override-test-dependencies-release-failure/verify.groovy b/src/it/override-test-dependencies-release-failure/verify.groovy
new file mode 100644
index 0000000000..72affbede7
--- /dev/null
+++ b/src/it/override-test-dependencies-release-failure/verify.groovy
@@ -0,0 +1,3 @@
+assert new File(basedir, 'build.log').getText('UTF-8').contains('Cannot override dependencies when doing a release')
+
+return true
diff --git a/src/it/override-test-dependencies-smokes/invoker.properties b/src/it/override-test-dependencies-smokes/invoker.properties
new file mode 100644
index 0000000000..384bd1fafb
--- /dev/null
+++ b/src/it/override-test-dependencies-smokes/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=-ntp test
diff --git a/src/it/override-test-dependencies-smokes/pom.xml b/src/it/override-test-dependencies-smokes/pom.xml
new file mode 100644
index 0000000000..ca03a5e2ab
--- /dev/null
+++ b/src/it/override-test-dependencies-smokes/pom.xml
@@ -0,0 +1,68 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ org.jenkins-ci.tools.hpi.its
+ override-test-dependencies-smokes
+ 1.0-SNAPSHOT
+ hpi
+
+ 2.249
+ @project.version@
+
+ org.jenkins-ci.plugins.workflow:workflow-step-api:2.11,org.jenkins-ci.plugins.workflow:workflow-api:2.17,org.jenkins-ci.plugins.workflow:workflow-cps:2.32
+ SampleTest
+ false
+ 0
+ 2.9
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ org.jenkins-ci.plugins
+ structs
+ 1.6
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-step-api
+ ${workflow-step-api-plugin.version}
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-step-api
+ ${workflow-step-api-plugin.version}
+ tests
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-cps
+ 2.30
+ test
+
+
+ antlr
+ antlr
+
+
+
+
+
diff --git a/src/it/override-test-dependencies-smokes/src/main/resources/index.jelly b/src/it/override-test-dependencies-smokes/src/main/resources/index.jelly
new file mode 100644
index 0000000000..2f655e510a
--- /dev/null
+++ b/src/it/override-test-dependencies-smokes/src/main/resources/index.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/it/override-test-dependencies-smokes/src/test/java/test/SampleTest.java b/src/it/override-test-dependencies-smokes/src/test/java/test/SampleTest.java
new file mode 100644
index 0000000000..a0a94d0658
--- /dev/null
+++ b/src/it/override-test-dependencies-smokes/src/test/java/test/SampleTest.java
@@ -0,0 +1,42 @@
+package test;
+
+import com.google.common.collect.ImmutableMap;
+import hudson.remoting.Which;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.jar.Manifest;
+import org.jenkinsci.plugins.workflow.steps.StepConfigTester;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.junit.Rule;
+import org.jvnet.hudson.test.JenkinsRule;
+
+public class SampleTest {
+
+ @Rule
+ public JenkinsRule r = new JenkinsRule();
+
+ @Test
+ public void smokes() throws Exception {
+ Map expectedVersions = ImmutableMap.of("workflow-step-api", "2.11", "workflow-api", "2.17", "workflow-cps", "2.32");
+ Enumeration manifests = SampleTest.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
+ while (manifests.hasMoreElements()) {
+ URL url = manifests.nextElement();
+ try (InputStream is = url.openStream()) {
+ Manifest mf = new Manifest(is);
+ String pluginName = mf.getMainAttributes().getValue("Short-Name");
+ String expectedVersion = expectedVersions.get(pluginName);
+ if (expectedVersion != null) {
+ assertEquals("wrong version for " + pluginName + " as classpath entry", expectedVersion, mf.getMainAttributes().getValue("Plugin-Version"));
+ }
+ }
+ }
+ for (Map.Entry entry : expectedVersions.entrySet()) {
+ assertEquals("wrong version for " + entry.getKey() + " as plugin", entry.getValue(), r.jenkins.pluginManager.getPlugin(entry.getKey()).getVersion());
+ }
+ assertEquals("workflow-step-api-2.11-tests.jar", Which.jarFile(StepConfigTester.class).getName());
+ }
+
+}
diff --git a/src/it/override-test-dependencies-smokes/verify.groovy b/src/it/override-test-dependencies-smokes/verify.groovy
new file mode 100644
index 0000000000..a4b7f510d8
--- /dev/null
+++ b/src/it/override-test-dependencies-smokes/verify.groovy
@@ -0,0 +1,3 @@
+def log = new File(basedir, 'build.log').text
+// TODO add anything needed, or delete this file
+true
\ No newline at end of file
diff --git a/src/it/override-test-dependencies-useUpperBounds/invoker.properties b/src/it/override-test-dependencies-useUpperBounds/invoker.properties
new file mode 100644
index 0000000000..384bd1fafb
--- /dev/null
+++ b/src/it/override-test-dependencies-useUpperBounds/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=-ntp test
diff --git a/src/it/override-test-dependencies-useUpperBounds/pom.xml b/src/it/override-test-dependencies-useUpperBounds/pom.xml
new file mode 100644
index 0000000000..fb9708b866
--- /dev/null
+++ b/src/it/override-test-dependencies-useUpperBounds/pom.xml
@@ -0,0 +1,68 @@
+
+
+ 4.0.0
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ org.jenkins-ci.tools.hpi.its
+ override-test-dependencies-useUpperBounds
+ 1.0-SNAPSHOT
+ hpi
+
+ 2.249
+ @project.version@
+ org.jenkins-ci.plugins.workflow:workflow-cps:2.33
+ true
+ SampleTest
+ false
+ 0
+ 2.9
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ org.jenkins-ci.plugins
+ structs
+ 1.6
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-step-api
+ ${workflow-step-api-plugin.version}
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-step-api
+ ${workflow-step-api-plugin.version}
+ tests
+ test
+
+
+ org.jenkins-ci.plugins.workflow
+ workflow-cps
+ 2.30
+ test
+
+
+ antlr
+ antlr
+
+
+
+
+
diff --git a/src/it/override-test-dependencies-useUpperBounds/src/main/resources/index.jelly b/src/it/override-test-dependencies-useUpperBounds/src/main/resources/index.jelly
new file mode 100644
index 0000000000..2f655e510a
--- /dev/null
+++ b/src/it/override-test-dependencies-useUpperBounds/src/main/resources/index.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/it/override-test-dependencies-useUpperBounds/src/test/java/test/SampleTest.java b/src/it/override-test-dependencies-useUpperBounds/src/test/java/test/SampleTest.java
new file mode 100644
index 0000000000..24ad880e7b
--- /dev/null
+++ b/src/it/override-test-dependencies-useUpperBounds/src/test/java/test/SampleTest.java
@@ -0,0 +1,42 @@
+package test;
+
+import com.google.common.collect.ImmutableMap;
+import hudson.remoting.Which;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.jar.Manifest;
+import org.jenkinsci.plugins.workflow.steps.StepConfigTester;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.junit.Rule;
+import org.jvnet.hudson.test.JenkinsRule;
+
+public class SampleTest {
+
+ @Rule
+ public JenkinsRule r = new JenkinsRule();
+
+ @Test
+ public void smokes() throws Exception {
+ Map expectedVersions = ImmutableMap.of("structs", "1.7", "workflow-step-api", "2.10", "workflow-api", "2.16", "workflow-cps", "2.33");
+ Enumeration manifests = SampleTest.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
+ while (manifests.hasMoreElements()) {
+ URL url = manifests.nextElement();
+ try (InputStream is = url.openStream()) {
+ Manifest mf = new Manifest(is);
+ String pluginName = mf.getMainAttributes().getValue("Short-Name");
+ String expectedVersion = expectedVersions.get(pluginName);
+ if (expectedVersion != null) {
+ assertEquals("wrong version for " + pluginName + " as classpath entry", expectedVersion, mf.getMainAttributes().getValue("Plugin-Version"));
+ }
+ }
+ }
+ for (Map.Entry entry : expectedVersions.entrySet()) {
+ assertEquals("wrong version for " + entry.getKey() + " as plugin", entry.getValue(), r.jenkins.pluginManager.getPlugin(entry.getKey()).getVersion());
+ }
+ assertEquals("workflow-step-api-2.10-tests.jar", Which.jarFile(StepConfigTester.class).getName());
+ }
+
+}
diff --git a/src/it/override-test-dependencies-useUpperBounds/verify.groovy b/src/it/override-test-dependencies-useUpperBounds/verify.groovy
new file mode 100644
index 0000000000..a4b7f510d8
--- /dev/null
+++ b/src/it/override-test-dependencies-useUpperBounds/verify.groovy
@@ -0,0 +1,3 @@
+def log = new File(basedir, 'build.log').text
+// TODO add anything needed, or delete this file
+true
\ No newline at end of file
diff --git a/src/it/parent-3x/invoker.properties b/src/it/parent-3x/invoker.properties
index 6585e7e052..47b870f5b9 100644
--- a/src/it/parent-3x/invoker.properties
+++ b/src/it/parent-3x/invoker.properties
@@ -1,3 +1,3 @@
# install, not verify, because we want to check the artifact as we would be about to deploy it
# release.skipTests normally set in jenkins-release profile since release:perform would do the tests
-invoker.goals=-Dstyle.color=always -ntp -Pjenkins-release -Drelease.skipTests=false clean install hpi:run
+invoker.goals=-ntp -Pjenkins-release -Drelease.skipTests=false clean install hpi:run
diff --git a/src/it/parent-3x/pom.xml b/src/it/parent-3x/pom.xml
index 6e80246c42..38fa691236 100644
--- a/src/it/parent-3x/pom.xml
+++ b/src/it/parent-3x/pom.xml
@@ -5,17 +5,18 @@
org.jenkins-ci.pluginsplugin
- 3.29
-
+ 3.57
+ org.jenkins-ci.tools.hpi.itsparent-3x1.0-SNAPSHOThpi
- 2.60.3
+ 2.249.18@project.version@
+ truefalse
@@ -34,7 +35,7 @@
org.jenkins-ci.pluginsstructs
- 1.5
+ 308.v852b473a2b8c
diff --git a/src/it/parent-3x/verify.groovy b/src/it/parent-3x/verify.groovy
index fa4517e675..239c1cdbc2 100644
--- a/src/it/parent-3x/verify.groovy
+++ b/src/it/parent-3x/verify.groovy
@@ -25,7 +25,7 @@ checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT.hpi',
['WEB-INF/lib/parent-3x.jar'],
// TODO still some problems with unwanted transitive JAR dependencies creeping in, e.g. WEB-INF/lib/jboss-marshalling-1.4.9.Final.jar in workflow-multibranch.hpi, or all kinds of junk in parameterized-trigger.hpi
['test/SampleRootAction.class', 'WEB-INF/lib/symbol-annotation-1.5.jar'],
- ['Short-Name': 'parent-3x', 'Group-Id': 'org.jenkins-ci.tools.hpi.its', 'Jenkins-Version': '2.60.3' /* Plugin-Version unpredictable for a snapshot */, 'Plugin-Dependencies': 'structs:1.5'])
+ ['Short-Name': 'parent-3x', 'Group-Id': 'org.jenkins-ci.tools.hpi.its', 'Jenkins-Version': '2.249.1' /* Plugin-Version unpredictable for a snapshot */, 'Plugin-Dependencies': 'structs:308.v852b473a2b8c'])
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT.jar',
['META-INF/annotations/hudson.Extension', 'test/SampleRootAction.class', 'index.jelly'],
diff --git a/src/it/process-jar/invoker.properties b/src/it/process-jar/invoker.properties
index 3df8a6127f..9b17b269c5 100644
--- a/src/it/process-jar/invoker.properties
+++ b/src/it/process-jar/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean verify
+invoker.goals=-ntp clean verify
diff --git a/src/it/process-jar/pom.xml b/src/it/process-jar/pom.xml
index aba4aeca90..62a0e67e01 100644
--- a/src/it/process-jar/pom.xml
+++ b/src/it/process-jar/pom.xml
@@ -1,3 +1,4 @@
+
@@ -6,7 +7,8 @@
org.jenkins-ci.pluginsplugin
- 3.29
+ 4.40
+ org.jenkins-ci.tools.hpi.its
@@ -16,8 +18,8 @@
hpi
- 2.60.3
- 8
+ 2.249.1
+ @project.version@MyNewPlugin
@@ -26,21 +28,12 @@
com.fasterxml.jackson.corejackson-databind
- 2.9.10.7
+ 2.13.2.1true
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- @project.groupId@
@@ -60,7 +53,6 @@
shaded
- 8
@@ -91,7 +83,7 @@
org.apache.maven.pluginsmaven-jarsigner-plugin
- 1.4
+ 3.0.0sign
diff --git a/src/it/process-jar/verify.groovy b/src/it/process-jar/verify.groovy
index 51283cd6bd..0177257994 100644
--- a/src/it/process-jar/verify.groovy
+++ b/src/it/process-jar/verify.groovy
@@ -25,9 +25,9 @@ assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/HelloWorldB
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/HelloWorldBuilder$DescriptorImpl.class').exists();
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.stapler').exists();
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/Messages.class').exists();
-assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-annotations-2.6.0.jar').exists();
-assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-core-2.6.3.jar').exists();
-assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-databind-2.6.3').exists();
+assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-annotations-2.13.2').exists();
+assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-core-2.13.2.jar').exists();
+assert !new File(basedir, 'target/process-jar/WEB-INF/lib/jackson-databind-2.13.2.1.jar').exists();
assert new File(basedir, 'target/process-jar.hpi').exists();
assert new File(basedir, 'target/process-jar.jar').exists();
diff --git a/src/it/snapshot-version-override/invoker.properties b/src/it/snapshot-version-override/invoker.properties
index 3df8a6127f..9b17b269c5 100644
--- a/src/it/snapshot-version-override/invoker.properties
+++ b/src/it/snapshot-version-override/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean verify
+invoker.goals=-ntp clean verify
diff --git a/src/it/snapshot-version-override/pom.xml b/src/it/snapshot-version-override/pom.xml
index daafdbe3c4..2a903962e9 100644
--- a/src/it/snapshot-version-override/pom.xml
+++ b/src/it/snapshot-version-override/pom.xml
@@ -1,43 +1,36 @@
+
-
- 4.0.0
+
+ 4.0.0org.jenkins-ci.pluginsplugin
- 3.29
+ 4.40
+
- org.jenkins-ci.tools.hpi.its
- snapshot-version-override
- 1.x-SNAPSHOT
+ org.jenkins-ci.tools.hpi.its
+ snapshot-version-override
+ 1.x-SNAPSHOT
- hpi
+ hpi
- MyNewPlugin
+ MyNewPlugin
- 2.60.3
- 8
+ 2.249.1
+ @project.version@
- scm:git:git://github.com/jenkinsci/maven-hpi-plugin.git
- scm:git:ssh://git@github.com/jenkinsci/maven-hpi-plugin.git
+ scm:git:https://github.com/jenkinsci/maven-hpi-plugin.git
+ scm:git:git@github.com:jenkinsci/maven-hpi-plugin.githttps://github.com/jenkinsci/maven-hpi-pluginHEAD
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
- com.github.stephenc.continuous
@@ -58,7 +51,6 @@
@project.groupId@@project.artifactId@
- @project.version@${actual-version}
diff --git a/src/it/verify-it/invoker.properties b/src/it/verify-it/invoker.properties
index 3df8a6127f..9b17b269c5 100644
--- a/src/it/verify-it/invoker.properties
+++ b/src/it/verify-it/invoker.properties
@@ -17,4 +17,4 @@
# under the License.
#
-invoker.goals=-Dstyle.color=always -ntp clean verify
+invoker.goals=-ntp clean verify
diff --git a/src/it/verify-it/pom.xml b/src/it/verify-it/pom.xml
index fb25610692..f0687a3251 100644
--- a/src/it/verify-it/pom.xml
+++ b/src/it/verify-it/pom.xml
@@ -1,12 +1,14 @@
+
4.0.0
-
- org.jenkins-ci.plugins
- plugin
- 3.29
-
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+ org.jenkins-ci.tools.hpi.itsverify-it
@@ -15,29 +17,33 @@
hpiMyNewPlugin
+ My New Plugin
+ https://github.com/jenkinsci/verify-it-plugin
-
- 2.60.3
- 8
-
-
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
-
-
-
- @project.groupId@
- @project.artifactId@
- @project.version@
-
-
-
+
+
+ MIT License
+ https://opensource.org/licenses/MIT
+
+
+
+
+ nchomsky
+ Noam Chomsky
+ nchomsky@example.com
+
+
+
+
+ scm:git:https://github.com/jenkinsci/verify-it-plugin.git
+ scm:git:git@github.com:jenkinsci/verify-it-plugin.git
+ HEAD
+ https://github.com/jenkinsci/verify-it-plugin
+
+
+
+ 2.249.1
+ @project.version@
+
diff --git a/src/it/verify-it/verify.groovy b/src/it/verify-it/verify.groovy
index 24bc104c41..6fc6509213 100644
--- a/src/it/verify-it/verify.groovy
+++ b/src/it/verify-it/verify.groovy
@@ -17,6 +17,9 @@
* under the License.
*/
+import java.nio.file.Files
+import java.util.jar.Manifest
+
assert new File(basedir, 'target/classes').exists();
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its').exists();
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.class').exists();
@@ -31,6 +34,30 @@ assert new File(basedir, 'target/generated-sources/localizer/org/jenkinsci/tools
content = new File(basedir, 'target/generated-sources/localizer/org/jenkinsci/tools/hpi/its/Messages.java').text;
assert content.contains(" holder.format(\"it.msg\");");
+assert new File(basedir, 'target/verify-it/META-INF/MANIFEST.MF').exists()
+
+Files.newInputStream(new File(basedir, 'target/verify-it/META-INF/MANIFEST.MF').toPath()).withCloseable { is ->
+ Manifest manifest = new Manifest(is)
+ assert !manifest.getMainAttributes().getValue('Build-Jdk-Spec').isEmpty()
+ assert manifest.getMainAttributes().getValue('Created-By').startsWith('Maven Archiver')
+ assert manifest.getMainAttributes().getValue('Extension-Name') == null // was provided by Maven 2, but core prefers Short-Name
+ assert manifest.getMainAttributes().getValue('Group-Id').equals('org.jenkins-ci.tools.hpi.its')
+ assert manifest.getMainAttributes().getValue('Hudson-Version').equals('2.249.1')
+ assert manifest.getMainAttributes().getValue('Implementation-Title').equals('MyNewPlugin') // was project.artifactId in previous versions, now project.name
+ assert manifest.getMainAttributes().getValue('Implementation-Version').equals('1.0-SNAPSHOT')
+ assert manifest.getMainAttributes().getValue('Jenkins-Version').equals('2.249.1')
+ assert manifest.getMainAttributes().getValue('Long-Name').equals('MyNewPlugin')
+ assert manifest.getMainAttributes().getValue('Manifest-Version').equals('1.0')
+ assert manifest.getMainAttributes().getValue('Plugin-Developers').equals('Noam Chomsky:nchomsky:nchomsky@example.com')
+ assert manifest.getMainAttributes().getValue('Plugin-License-Name').equals('MIT License')
+ assert manifest.getMainAttributes().getValue('Plugin-License-Url').equals('https://opensource.org/licenses/MIT')
+ assert manifest.getMainAttributes().getValue('Plugin-ScmUrl').equals('https://github.com/jenkinsci/verify-it-plugin')
+ assert manifest.getMainAttributes().getValue('Plugin-Version').startsWith('1.0-SNAPSHOT')
+ assert manifest.getMainAttributes().getValue('Short-Name').equals('verify-it')
+ assert manifest.getMainAttributes().getValue('Specification-Title').equals('MyNewPlugin') // was project.description in previous versions, now project.name
+ assert manifest.getMainAttributes().getValue('Url').equals('https://github.com/jenkinsci/verify-it-plugin')
+}
+
// TODO add some test on hpi file content
return true;
\ No newline at end of file
diff --git a/src/main/java/hudson/Extension.java b/src/main/java/hudson/Extension.java
index 4b1744a1cb..7269834d4c 100644
--- a/src/main/java/hudson/Extension.java
+++ b/src/main/java/hudson/Extension.java
@@ -25,13 +25,11 @@
import jenkins.YesNoMaybe;
-import static jenkins.YesNoMaybe.MAYBE;
-
/**
* Minimal clone to convince Sezpoz.
*
* @author Kohsuke Kawaguchi
*/
public @interface Extension {
- YesNoMaybe dynamicLoadable() default MAYBE;
+ YesNoMaybe dynamicLoadable() default YesNoMaybe.MAYBE;
}
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractDependencyGraphTraversingMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractDependencyGraphTraversingMojo.java
index ce8bdcc152..9556e649df 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractDependencyGraphTraversingMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractDependencyGraphTraversingMojo.java
@@ -1,6 +1,8 @@
package org.jenkinsci.maven.plugins.hpi;
import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
import org.apache.maven.shared.dependency.graph.DependencyNode;
@@ -16,7 +18,10 @@ public abstract class AbstractDependencyGraphTraversingMojo extends AbstractJenk
* Traverses the whole dependency tree rooted at the project.
*/
protected void traverseProject() throws DependencyGraphBuilderException {
- visit(graphBuilder.buildDependencyGraph(project, null));
+ ProjectBuildingRequest buildingRequest =
+ new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
+ buildingRequest.setProject(project);
+ visit(graphBuilder.buildDependencyGraph(buildingRequest, null));
}
/**
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java
index ded67fc44c..54c0f7eb54 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractHpiMojo.java
@@ -17,13 +17,12 @@
*/
import com.google.common.collect.Sets;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
@@ -31,12 +30,14 @@
import java.io.Writer;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
@@ -61,6 +62,7 @@
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.InterpolationFilterReader;
+import org.codehaus.plexus.util.PropertyUtils;
import org.codehaus.plexus.util.StringUtils;
public abstract class AbstractHpiMojo extends AbstractJenkinsMojo {
@@ -129,7 +131,7 @@ public abstract class AbstractHpiMojo extends AbstractJenkinsMojo {
* The directory where the webapp is built.
*/
@Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}")
- protected File webappDirectory;
+ private File webappDirectory;
/**
* Single directory for extra files to include in the WAR.
@@ -279,7 +281,7 @@ public void setContainerConfigXML(File containerConfigXML) {
* @return an array of tokens to exclude
*/
protected String[] getExcludes() {
- List excludeList = new ArrayList();
+ List excludeList = new ArrayList<>();
if (StringUtils.isNotEmpty(warSourceExcludes)) {
excludeList.addAll(Arrays.asList(StringUtils.split(warSourceExcludes, ",")));
}
@@ -299,7 +301,7 @@ protected String[] getExcludes() {
* @return an array of tokens to include
*/
protected String[] getIncludes() {
- return StringUtils.split(StringUtils.defaultString(warSourceIncludes), ",");
+ return StringUtils.split(Objects.toString(warSourceIncludes), ",");
}
/**
@@ -325,20 +327,32 @@ protected String[] getDependentWarExcludes() {
* @return an array of tokens to include
*/
protected String[] getDependentWarIncludes() {
- return StringUtils.split(StringUtils.defaultString(dependentWarIncludes), ",");
+ return StringUtils.split(Objects.toString(dependentWarIncludes), ",");
}
public void buildExplodedWebapp(File webappDirectory, File jarFile)
throws MojoExecutionException {
getLog().info("Exploding webapp...");
- webappDirectory.mkdirs();
+ try {
+ Files.createDirectories(webappDirectory.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create directories for '" + webappDirectory + "'", e);
+ }
File webinfDir = new File(webappDirectory, WEB_INF);
- webinfDir.mkdirs();
+ try {
+ Files.createDirectories(webinfDir.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create directories for '" + webinfDir + "'", e);
+ }
File metainfDir = new File(webappDirectory, META_INF);
- metainfDir.mkdirs();
+ try {
+ Files.createDirectories(metainfDir.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create directories for '" + metainfDir + "'", e);
+ }
try {
List webResources = this.webResources != null ? Arrays.asList(this.webResources) : null;
@@ -354,12 +368,12 @@ public void buildExplodedWebapp(File webappDirectory, File jarFile)
if (containerConfigXML != null && StringUtils.isNotEmpty(containerConfigXML.getName())) {
metainfDir = new File(webappDirectory, META_INF);
String xmlFileName = containerConfigXML.getName();
- copyFileIfModified(containerConfigXML, new File(metainfDir, xmlFileName));
+ FileUtils.copyFileIfModified(containerConfigXML, new File(metainfDir, xmlFileName));
}
buildWebapp(project, webappDirectory);
- copyFileIfModified(jarFile, new File(getWebappDirectory(),"WEB-INF/lib/"+jarFile.getName()));
+ FileUtils.copyFileIfModified(jarFile, new File(getWebappDirectory(),"WEB-INF/lib/"+jarFile.getName()));
}
catch (IOException e) {
throw new MojoExecutionException("Could not explode webapp...", e);
@@ -376,7 +390,7 @@ private Properties getBuildFilterProperties()
for (String filter : filters) {
try {
- Properties properties = PropertyUtils.loadPropertyFile(new File(filter), true, true);
+ Properties properties = PropertyUtils.loadProperties(new File(filter));
filterProperties.putAll(properties);
}
@@ -397,7 +411,6 @@ private Properties getBuildFilterProperties()
*
* @param resource the resource to copy
* @param webappDirectory the target directory
- * @param filterProperties
* @throws java.io.IOException if an error occurred while copying webResources
*/
public void copyResources(Resource resource, File webappDirectory, Properties filterProperties)
@@ -407,17 +420,13 @@ public void copyResources(Resource resource, File webappDirectory, Properties fi
if (webappDirectory.exists()) {
String[] fileNames = getWarFiles(resource);
for (String fileName : fileNames) {
- File targetDirectory = webappDirectory;
- if (StringUtils.isNotBlank(resource.getTargetPath())) {
- targetDirectory = new File(webappDirectory, resource.getTargetPath());
- }
if (resource.isFiltering()) {
copyFilteredFile(new File(resource.getDirectory(), fileName),
- new File(targetDirectory, fileName), null, getFilterWrappers(),
+ new File(webappDirectory, fileName), null, getFilterWrappers(),
filterProperties);
} else {
- copyFileIfModified(new File(resource.getDirectory(), fileName),
- new File(targetDirectory, fileName));
+ FileUtils.copyFileIfModified(new File(resource.getDirectory(), fileName),
+ new File(webappDirectory, fileName));
}
}
}
@@ -443,7 +452,7 @@ public void copyResources(File sourceDirectory, File webappDirectory)
if (warSourceDirectory.exists()) {
String[] fileNames = getWarFiles(sourceDirectory);
for (String fileName : fileNames) {
- copyFileIfModified(new File(sourceDirectory, fileName),
+ FileUtils.copyFileIfModified(new File(sourceDirectory, fileName),
new File(webappDirectory, fileName));
}
}
@@ -479,7 +488,6 @@ protected Set wrap(Iterable artifacts) {
* the {@code webappDirectory} during this phase.
*
* @param project the maven project
- * @param webappDirectory
* @throws java.io.IOException if an error occurred while building the webapp
*/
public void buildWebapp(MavenProject project, File webappDirectory)
@@ -497,7 +505,7 @@ public void buildWebapp(MavenProject project, File webappDirectory)
List duplicates = findDuplicates(artifacts);
- List dependentWarDirectories = new ArrayList();
+ List dependentWarDirectories = new ArrayList<>();
// List up IDs of Jenkins plugin dependencies
Set jenkinsPlugins = new HashSet<>();
@@ -554,10 +562,10 @@ public void buildWebapp(MavenProject project, File webappDirectory)
}
String type = artifact.getType();
if ("tld".equals(type)) {
- copyFileIfModified(artifact.getFile(), new File(tldDirectory, targetFileName));
+ FileUtils.copyFileIfModified(artifact.getFile(), new File(tldDirectory, targetFileName));
} else {
if ("jar".equals(type) || "ejb".equals(type) || "ejb-client".equals(type)) {
- copyFileIfModified(artifact.getFile(), new File(libDirectory, targetFileName));
+ FileUtils.copyFileIfModified(artifact.getFile(), new File(libDirectory, targetFileName));
} else {
if ("par".equals(type)) {
targetFileName = targetFileName.substring(0, targetFileName.lastIndexOf('.')) + ".jar";
@@ -565,7 +573,7 @@ public void buildWebapp(MavenProject project, File webappDirectory)
getLog().debug(
"Copying " + artifact.getFile() + " to " + new File(libDirectory, targetFileName));
- copyFileIfModified(artifact.getFile(), new File(libDirectory, targetFileName));
+ FileUtils.copyFileIfModified(artifact.getFile(), new File(libDirectory, targetFileName));
} else {
if ("war".equals(type)) {
dependentWarDirectories.add(unpackWarToTempDirectory(artifact));
@@ -582,8 +590,8 @@ public void buildWebapp(MavenProject project, File webappDirectory)
getLog().info("Overlaying " + dependentWarDirectories.size() + " war(s).");
// overlay dependent wars
- for (Iterator iter = dependentWarDirectories.iterator(); iter.hasNext();) {
- copyDependentWarContents((File) iter.next(), webappDirectory);
+ for (File dependentWarDirectory : dependentWarDirectories) {
+ copyDependentWarContents(dependentWarDirectory, webappDirectory);
}
}
}
@@ -595,8 +603,8 @@ public void buildWebapp(MavenProject project, File webappDirectory)
* @return List of duplicated artifacts
*/
private List findDuplicates(Set artifacts) {
- List duplicates = new ArrayList();
- List identifiers = new ArrayList();
+ List duplicates = new ArrayList<>();
+ List identifiers = new ArrayList<>();
for (MavenArtifact artifact : artifacts) {
String candidate = artifact.getDefaultFinalName();
if (identifiers.contains(candidate)) {
@@ -614,7 +622,6 @@ private List findDuplicates(Set artifacts) {
*
* @param artifact War artifact to unpack.
* @return Directory containing the unpacked war.
- * @throws MojoExecutionException
*/
private File unpackWarToTempDirectory(MavenArtifact artifact)
throws MojoExecutionException {
@@ -622,8 +629,12 @@ private File unpackWarToTempDirectory(MavenArtifact artifact)
File tempLocation = new File(workDirectory, name.substring(0, name.length() - 4));
boolean process = false;
- if (!tempLocation.exists()) {
- tempLocation.mkdirs();
+ if (!Files.isDirectory(tempLocation.toPath())) {
+ try {
+ Files.createDirectories(tempLocation.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create directories for '" + tempLocation + "'", e);
+ }
process = true;
} else if (artifact.getFile().lastModified() > tempLocation.lastModified()) {
process = true;
@@ -658,9 +669,6 @@ private void unpack(File file, File location)
unArchiver.setDestDirectory(location);
unArchiver.extract();
}
- catch (IOException e) {
- throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e);
- }
catch (ArchiverException e) {
throw new MojoExecutionException("Error unpacking file: " + file + "to: " + location, e);
}
@@ -685,17 +693,26 @@ private void copyDependentWarContents(File srcDir, File targetDir)
scanner.scan();
for (String dir : scanner.getIncludedDirectories()) {
- new File(targetDir, dir).mkdirs();
+ File includeDir = new File(targetDir, dir);
+ try {
+ Files.createDirectories(includeDir.toPath());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create directories for '" + includeDir + "'", e);
+ }
}
for (String file : scanner.getIncludedFiles()) {
File targetFile = new File(targetDir, file);
// Do not overwrite existing files.
- if (!targetFile.exists()) {
+ if (!Files.exists(targetFile.toPath())) {
try {
- targetFile.getParentFile().mkdirs();
- copyFileIfModified(new File(srcDir, file), targetFile);
+ Files.createDirectories(targetFile.toPath().getParent());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create parent directories for '" + targetFile + "'", e);
+ }
+ try {
+ FileUtils.copyFileIfModified(new File(srcDir, file), targetFile);
}
catch (IOException e) {
throw new MojoExecutionException("Error copying file '" + file + "' to '" + targetFile + "'",
@@ -736,12 +753,12 @@ private String[] getWarFiles(Resource resource) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(resource.getDirectory());
if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
- scanner.setIncludes((String[]) resource.getIncludes().toArray(EMPTY_STRING_ARRAY));
+ scanner.setIncludes(resource.getIncludes().toArray(EMPTY_STRING_ARRAY));
} else {
scanner.setIncludes(DEFAULT_INCLUDES);
}
if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
- scanner.setExcludes((String[]) resource.getExcludes().toArray(EMPTY_STRING_ARRAY));
+ scanner.setExcludes(resource.getExcludes().toArray(EMPTY_STRING_ARRAY));
}
scanner.addDefaultExcludes();
@@ -751,42 +768,18 @@ private String[] getWarFiles(Resource resource) {
return scanner.getIncludedFiles();
}
- /**
- * Copy file from source to destination only if source is newer than the target file.
- * If destinationDirectory does not exist, it
- * (and any parent directories) will be created. If a file source in
- * destinationDirectory exists, it will be overwritten.
- *
- * @param source An existing File to copy.
- * @param destinationDirectory A directory to copy source into.
- * @throws java.io.FileNotFoundException if source isn't a normal file.
- * @throws IllegalArgumentException if destinationDirectory isn't a directory.
- * @throws java.io.IOException if source does not exist, the file in
- * destinationDirectory cannot be written to, or an IO error occurs during copying.
- *
- * TO DO: Remove this method when Maven moves to plexus-utils version 1.4
- */
- private static void copyFileToDirectoryIfModified(File source, File destinationDirectory)
- throws IOException {
- // TO DO: Remove this method and use the method in WarFileUtils when Maven 2 changes
- // to plexus-utils 1.2.
- if (destinationDirectory.exists() && !destinationDirectory.isDirectory()) {
- throw new IllegalArgumentException("Destination is not a directory");
- }
-
- copyFileIfModified(source, new File(destinationDirectory, source.getName()));
- }
-
private FilterWrapper[] getFilterWrappers() {
return new FilterWrapper[]{
// support ${token}
new FilterWrapper() {
+ @Override
public Reader getReader(Reader fileReader, Properties filterProperties) {
return new InterpolationFilterReader(fileReader, filterProperties, "${", "}");
}
},
// support @token@
new FilterWrapper() {
+ @Override
public Reader getReader(Reader fileReader, Properties filterProperties) {
return new InterpolationFilterReader(fileReader, filterProperties, "@", "@");
}
@@ -794,11 +787,6 @@ public Reader getReader(Reader fileReader, Properties filterProperties) {
}
/**
- * @param from
- * @param to
- * @param encoding
- * @param wrappers
- * @param filterProperties
* @throws IOException TO DO: Remove this method when Maven moves to plexus-utils version 1.4
*/
private static void copyFilteredFile(File from, File to, String encoding, FilterWrapper[] wrappers,
@@ -809,11 +797,11 @@ private static void copyFilteredFile(File from, File to, String encoding, Filter
Writer fileWriter = null;
try {
// fix for MWAR-36, ensures that the parent dir are created first
- to.getParentFile().mkdirs();
+ Files.createDirectories(to.toPath().getParent());
if (encoding == null || encoding.length() < 1) {
- fileReader = new BufferedReader(new FileReader(from));
- fileWriter = new FileWriter(to);
+ fileReader = Files.newBufferedReader(from.toPath(), StandardCharsets.UTF_8);
+ fileWriter = Files.newBufferedWriter(to.toPath(), StandardCharsets.UTF_8);
} else {
FileInputStream instream = new FileInputStream(from);
@@ -837,74 +825,6 @@ private static void copyFilteredFile(File from, File to, String encoding, Filter
}
}
- /**
- * Copy file from source to destination only if source timestamp is later than the destination timestamp.
- * The directories up to destination will be created if they don't already exist.
- * destination will be overwritten if it already exists.
- *
- * @param source An existing non-directory File to copy bytes from.
- * @param destination A non-directory File to write bytes to (possibly
- * overwriting).
- * @throws IOException if source does not exist, destination cannot be
- * written to, or an IO error occurs during copying.
- * @throws java.io.FileNotFoundException if destination is a directory
- *
- * TO DO: Remove this method when Maven moves to plexus-utils version 1.4
- */
- private static void copyFileIfModified(File source, File destination)
- throws IOException {
- // TO DO: Remove this method and use the method in WarFileUtils when Maven 2 changes
- // to plexus-utils 1.2.
- if (destination.lastModified() < source.lastModified()) {
- FileUtils.copyFile(source, destination);
- }
- }
-
- /**
- * Copies a entire directory structure but only source files with timestamp later than the destinations'.
- *
- * Note:
- *
- *
It will include empty directories.
- *
The sourceDirectory must exists.
- *
- *
- * @param sourceDirectory
- * @param destinationDirectory
- * @throws IOException TO DO: Remove this method when Maven moves to plexus-utils version 1.4
- */
- private static void copyDirectoryStructureIfModified(File sourceDirectory, File destinationDirectory)
- throws IOException {
- if (!sourceDirectory.exists()) {
- throw new IOException("Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ").");
- }
-
- String sourcePath = sourceDirectory.getAbsolutePath();
-
- for (File file : sourceDirectory.listFiles()) {
- String dest = file.getAbsolutePath();
-
- dest = dest.substring(sourcePath.length() + 1);
-
- File destination = new File(destinationDirectory, dest);
-
- if (file.isFile()) {
- destination = destination.getParentFile();
-
- copyFileToDirectoryIfModified(file, destination);
- } else if (file.isDirectory()) {
- if (!destination.exists() && !destination.mkdirs()) {
- throw new IOException(
- "Could not create destination directory '" + destination.getAbsolutePath() + "'.");
- }
-
- copyDirectoryStructureIfModified(file, destination);
- } else {
- throw new IOException("Unknown file type: " + file.getAbsolutePath());
- }
- }
- }
-
/**
* If the project is on Git, figure out Git SHA1.
*
@@ -921,17 +841,17 @@ public String getGitHeadSha1() {
}
try {
- Process p = new ProcessBuilder("git", "rev-parse", "HEAD").redirectErrorStream(true).start();
+ Process p = new ProcessBuilder("git", "-C", git.getAbsolutePath(), "rev-parse", "HEAD").redirectErrorStream(true).start();
p.getOutputStream().close();
String v = IOUtils.toString(p.getInputStream()).trim();
if (p.waitFor()!=0)
return null; // git rev-parse failed to run
- return v.trim().substring(0,8);
- } catch (IOException e) {
- LOGGER.log(Level.FINE, "Failed to run git rev-parse HEAD",e);
- return null;
- } catch (InterruptedException e) {
+ if (v.length()<8)
+ return null; // git repository present, but without commits
+
+ return v.substring(0,8);
+ } catch (IOException | InterruptedException e) {
LOGGER.log(Level.FINE, "Failed to run git rev-parse HEAD",e);
return null;
}
@@ -950,6 +870,7 @@ private interface FilterWrapper {
* False, if the answer is known to be "No". Otherwise null, if there are some extensions
* we don't know we can dynamic load. Otherwise, if everything is known to be dynamic loadable, return true.
*/
+ @SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "TODO needs triage")
protected Boolean isSupportDynamicLoading() throws IOException {
URLClassLoader cl = new URLClassLoader(new URL[]{
new File(project.getBuild().getOutputDirectory()).toURI().toURL()
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java
index a62e112acf..79f0d201f9 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java
@@ -15,6 +15,7 @@
*/
package org.jenkinsci.maven.plugins.hpi;
+import org.apache.maven.archiver.ManifestConfiguration;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
import org.apache.maven.artifact.Artifact;
@@ -26,18 +27,19 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.archiver.jar.Manifest;
import org.codehaus.plexus.archiver.jar.ManifestException;
-import org.codehaus.plexus.util.IOUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.text.SimpleDateFormat;
-import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
@@ -59,6 +61,7 @@ public abstract class AbstractJenkinsManifestMojo extends AbstractHpiMojo {
/**
* Optional - the oldest version of this plugin which the current version is
* configuration-compatible with.
+ * @see Mark a new plugin version as incompatible with older versions
*/
@Parameter(property = "hpi.compatibleSinceVersion")
private String compatibleSinceVersion;
@@ -71,8 +74,11 @@ public abstract class AbstractJenkinsManifestMojo extends AbstractHpiMojo {
/**
* Specify the minimum version of Java that this plugin requires.
+ *
+ * @deprecated removed without replacement
*/
- @Parameter(required = true)
+ @Deprecated
+ @Parameter
protected String minimumJavaVersion;
/**
@@ -80,42 +86,43 @@ public abstract class AbstractJenkinsManifestMojo extends AbstractHpiMojo {
*/
protected void generateManifest(MavenArchiveConfiguration archive, File manifestFile) throws MojoExecutionException {
// create directory if it doesn't exist yet
- if (!manifestFile.getParentFile().exists())
- manifestFile.getParentFile().mkdirs();
+ if (!Files.isDirectory(manifestFile.toPath().getParent())) {
+ try {
+ Files.createDirectories(manifestFile.toPath().getParent());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to create parent directories for '" + manifestFile + "'", e);
+ }
+ }
getLog().info("Generating " + manifestFile);
MavenArchiver ma = new MavenArchiver();
ma.setOutputFile(manifestFile);
- PrintWriter printWriter = null;
- try {
- Manifest mf = ma.getManifest(project, archive.getManifest());
- Manifest.Section mainSection = mf.getMainSection();
+ try (PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(manifestFile), StandardCharsets.UTF_8))) {
+ ManifestConfiguration config = archive.getManifest();
+ config.setAddDefaultSpecificationEntries(true);
+ config.setAddDefaultImplementationEntries(true);
+ Manifest mf = ma.getManifest(project, config);
+ Manifest.ExistingSection mainSection = mf.getMainSection();
setAttributes(mainSection);
- printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(manifestFile), "UTF-8"));
mf.write(printWriter);
- } catch (ManifestException e) {
- throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
- } catch (DependencyResolutionRequiredException e) {
+ } catch (ManifestException | IOException | DependencyResolutionRequiredException e) {
throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
- } catch (IOException e) {
- throw new MojoExecutionException("Error preparing the manifest: " + e.getMessage(), e);
- } finally {
- IOUtil.close(printWriter);
}
}
- protected void setAttributes(Manifest.Section mainSection) throws MojoExecutionException, ManifestException, IOException {
+ protected void setAttributes(Manifest.ExistingSection mainSection) throws MojoExecutionException, ManifestException, IOException {
File pluginImpl = new File(project.getBuild().getOutputDirectory(), "META-INF/services/hudson.Plugin");
if(pluginImpl.exists()) {
- BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pluginImpl),"UTF-8"));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pluginImpl), StandardCharsets.UTF_8));
String pluginClassName = in.readLine();
in.close();
mainSection.addAttributeAndCheck(new Manifest.Attribute("Plugin-Class",pluginClassName));
}
+
mainSection.addAttributeAndCheck(new Manifest.Attribute("Group-Id",project.getGroupId()));
mainSection.addAttributeAndCheck(new Manifest.Attribute("Short-Name",project.getArtifactId()));
mainSection.addAttributeAndCheck(new Manifest.Attribute("Long-Name",pluginName));
@@ -126,20 +133,11 @@ protected void setAttributes(Manifest.Section mainSection) throws MojoExecutionE
if (compatibleSinceVersion!=null)
mainSection.addAttributeAndCheck(new Manifest.Attribute("Compatible-Since-Version", compatibleSinceVersion));
- if (this.minimumJavaVersion == null) {
- throw new MojoExecutionException("minimumJavaVersion attribute must be set starting from version 2.8");
- }
- try {
- int res = Integer.parseInt(this.minimumJavaVersion);
- LOGGER.log(Level.INFO, "Minimum Java version for the plugin: {0}", this.minimumJavaVersion);
- } catch(NumberFormatException ex) {
- if (this.minimumJavaVersion.equals("1.6") || this.minimumJavaVersion.equals("1.7") || this.minimumJavaVersion.equals("1.8")) {
- // okay
- } else {
- throw new MojoExecutionException("Unsupported Java version string: `" + this.minimumJavaVersion + "`. If you use Java 9 or above, see https://openjdk.java.net/jeps/223");
- }
+ if (this.minimumJavaVersion != null && !this.minimumJavaVersion.isEmpty()) {
+ getLog().warn("Ignoring deprecated minimumJavaVersion parameter."
+ + " This property should be removed from your plugin's POM."
+ + " In the future this warning will be changed to an error and will break the build.");
}
- mainSection.addAttributeAndCheck(new Manifest.Attribute("Minimum-Java-Version", this.minimumJavaVersion));
if (sandboxStatus!=null)
mainSection.addAttributeAndCheck(new Manifest.Attribute("Sandbox-Status", sandboxStatus));
@@ -238,7 +236,7 @@ private String findDependencyPlugins() throws IOException, MojoExecutionExceptio
// check any "provided" scope plugin dependencies that are probably not what the user intended.
// see http://jenkins-ci.361315.n4.nabble.com/Classloading-problem-when-referencing-classes-from-another-plugin-during-the-initialization-phase-of-td394967.html
- for (Artifact a : (Collection)project.getDependencyArtifacts())
+ for (Artifact a : project.getDependencyArtifacts())
if ("provided".equals(a.getScope()) && wrap(a).isPlugin())
throw new MojoExecutionException(a.getId()+" is marked as 'provided' scope dependency, but it should be the 'compile' scope.");
@@ -252,8 +250,7 @@ private String findDependencyPlugins() throws IOException, MojoExecutionExceptio
private String getDevelopersForManifest() throws IOException {
StringBuilder buf = new StringBuilder();
- for (Object o : project.getDevelopers()) {
- Developer d = (Developer) o;
+ for (Developer d : project.getDevelopers()) {
if (buf.length() > 0) {
buf.append(',');
}
@@ -268,15 +265,12 @@ private String getDevelopersForManifest() throws IOException {
}
protected Manifest loadManifest(File f) throws IOException, ManifestException {
- InputStreamReader r = new InputStreamReader(new FileInputStream(f), "UTF-8");
- try {
- return new Manifest(r);
- } finally {
- IOUtil.close(r);
+ try (InputStream is = Files.newInputStream(f.toPath())) {
+ return new Manifest(is);
}
}
- private void addLicenseAttributesForManifest(Manifest.Section target) throws ManifestException {
+ private void addLicenseAttributesForManifest(Manifest.ExistingSection target) throws ManifestException {
final List licenses = project.getLicenses();
int licenseCounter = 1;
for (License lic : licenses) {
@@ -298,14 +292,14 @@ private String getScmUrl() {
return null;
}
- private void addAttributeIfNotNull(Manifest.Section target, String attributeName, String propertyValue)
+ private void addAttributeIfNotNull(Manifest.ExistingSection target, String attributeName, String propertyValue)
throws ManifestException {
if (propertyValue != null) {
target.addAttributeAndCheck(new Manifest.Attribute(attributeName, propertyValue));
}
}
- private void addPropertyAttributeIfNotNull(Manifest.Section target, String attributeName, String propertyName)
+ private void addPropertyAttributeIfNotNull(Manifest.ExistingSection target, String attributeName, String propertyName)
throws ManifestException {
String propertyValue = project.getProperties().getProperty(propertyName);
if (propertyValue != null) {
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsMojo.java
index ea8cbd15fc..bfd62f83dd 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsMojo.java
@@ -1,22 +1,27 @@
package org.jenkinsci.maven.plugins.hpi;
import hudson.util.VersionNumber;
-import org.apache.commons.lang.StringUtils;
+import io.jenkins.lib.versionnumber.JavaSpecificationVersion;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.MavenProjectHelper;
-
-import java.util.List;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
+import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
/**
* Mojos that need to figure out the Jenkins version it's working with.
@@ -28,9 +33,12 @@ public abstract class AbstractJenkinsMojo extends AbstractMojo {
/**
* The maven project.
*/
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
protected MavenProject project;
+ @Parameter(defaultValue = "${session}", required = true, readonly = true)
+ protected MavenSession session;
+
/**
* Optional string that represents "groupId:artifactId" of Jenkins core jar.
* If left unspecified, the default groupId/artifactId pair for Jenkins is looked for.
@@ -48,20 +56,6 @@ public abstract class AbstractJenkinsMojo extends AbstractMojo {
@Parameter
private String jenkinsCoreVersionOverride;
-
- /**
- * List of Remote Repositories used by the resolver
- */
- @Parameter(defaultValue = "${project.remoteArtifactRepositories}",readonly = true, required = true)
- protected List remoteRepos;
-
- @Component
- @Parameter(defaultValue = "${localRepository}", readonly = true, required = true)
- protected ArtifactRepository localRepository;
-
- @Component
- protected ArtifactMetadataSource artifactMetadataSource;
-
@Component
protected ArtifactFactory artifactFactory;
@@ -69,14 +63,14 @@ public abstract class AbstractJenkinsMojo extends AbstractMojo {
protected ArtifactResolver artifactResolver;
@Component
- protected MavenProjectBuilder projectBuilder;
+ protected ProjectBuilder projectBuilder;
@Component
protected MavenProjectHelper projectHelper;
protected String findJenkinsVersion() throws MojoExecutionException {
- for(Dependency a : (List)project.getDependencies()) {
+ for(Dependency a : project.getDependencies()) {
boolean match;
if (jenkinsCoreId!=null)
match = (a.getGroupId()+':'+a.getArtifactId()).equals(jenkinsCoreId);
@@ -85,7 +79,7 @@ protected String findJenkinsVersion() throws MojoExecutionException {
&& (a.getArtifactId().equals("jenkins-core") || a.getArtifactId().equals("hudson-core"));
if (match) {
- if (StringUtils.isNotBlank(jenkinsCoreVersionOverride)) {
+ if (jenkinsCoreVersionOverride != null && !jenkinsCoreVersionOverride.trim().isEmpty()) {
VersionNumber v1 = new VersionNumber(a.getVersion());
VersionNumber v2 = new VersionNumber(jenkinsCoreVersionOverride);
if (v1.compareTo(v2) == -1) {
@@ -98,13 +92,60 @@ protected String findJenkinsVersion() throws MojoExecutionException {
return a.getVersion();
}
}
- if (StringUtils.isNotBlank(jenkinsCoreVersionOverride)) {
+ if (jenkinsCoreVersionOverride != null && !jenkinsCoreVersionOverride.trim().isEmpty()) {
return jenkinsCoreVersionOverride;
}
throw new MojoExecutionException("Failed to determine Jenkins version this plugin depends on.");
}
+ protected JavaSpecificationVersion getMinimumJavaVersion() throws MojoExecutionException {
+ Artifact core = resolveJenkinsCore();
+ File jar = wrap(core).getFile();
+ try (JarFile jarFile = new JarFile(jar)) {
+ ZipEntry entry = jarFile.getEntry("jenkins/model/Jenkins.class");
+ if (entry == null) {
+ throw new MojoExecutionException("Failed to find Jenkins.class in " + jar);
+ }
+ try (InputStream is = jarFile.getInputStream(entry); DataInputStream dis = new DataInputStream(is)) {
+ int magic = dis.readInt();
+ if (magic != 0xcafebabe) {
+ throw new MojoExecutionException("Jenkins.class is not a valid class file in " + jar);
+ }
+ dis.readUnsignedShort(); // discard minor version
+ return JavaSpecificationVersion.fromClassVersion(dis.readUnsignedShort());
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to read minimum Java version from " + jar, e);
+ }
+ }
+
+ private Artifact resolveJenkinsCore() throws MojoExecutionException {
+ DefaultArtifactCoordinate artifactCoordinate = new DefaultArtifactCoordinate();
+ if (jenkinsCoreId != null) {
+ String[] parts = jenkinsCoreId.split(":");
+ artifactCoordinate.setGroupId(parts[0]);
+ artifactCoordinate.setArtifactId(parts[1]);
+ } else {
+ artifactCoordinate.setGroupId("org.jenkins-ci.main");
+ artifactCoordinate.setArtifactId("jenkins-core");
+ }
+ artifactCoordinate.setVersion(findJenkinsVersion());
+
+ try {
+ return artifactResolver
+ .resolveArtifact(session.getProjectBuildingRequest(), artifactCoordinate)
+ .getArtifact();
+ } catch (ArtifactResolverException e) {
+ throw new MojoExecutionException("Couldn't download artifact: ", e);
+ }
+ }
+
protected MavenArtifact wrap(Artifact a) {
- return new MavenArtifact(a,artifactResolver,artifactFactory,projectBuilder,remoteRepos,localRepository);
+ return new MavenArtifact(
+ a,
+ artifactResolver,
+ artifactFactory,
+ projectBuilder,
+ session);
}
}
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJettyMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJettyMojo.java
index 962a9fe04a..6ea31a2bcf 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJettyMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJettyMojo.java
@@ -26,6 +26,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
@@ -38,7 +39,6 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
@@ -51,9 +51,7 @@
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.NCSARequestLog;
-import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.RequestLog;
-import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ShutdownMonitor;
import org.eclipse.jetty.server.handler.ContextHandler;
@@ -233,7 +231,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo
/**
* The maven project.
*/
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
protected MavenProject project;
@@ -241,7 +239,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo
* The artifacts for the project.
*/
@Parameter(defaultValue = "${project.artifacts}")
- protected Set projectArtifacts;
+ protected Set projectArtifacts;
@Parameter(defaultValue = "${mojoExecution}", readonly = true)
@@ -252,7 +250,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo
* The artifacts for the plugin itself.
*/
@Parameter(defaultValue = "${plugin.artifacts}", readonly = true)
- protected List pluginArtifacts;
+ protected List pluginArtifacts;
@@ -323,6 +321,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo
/**
* @see org.apache.maven.plugin.Mojo#execute()
*/
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException
{
getLog().info("Configuring Jetty for project: " + this.project.getName());
@@ -348,9 +347,6 @@ public void execute() throws MojoExecutionException, MojoFailureException
- /**
- * @throws MojoExecutionException
- */
public void configurePluginClasspath() throws MojoExecutionException
{
//if we are configured to include the provided dependencies on the plugin's classpath
@@ -361,12 +357,10 @@ public void configurePluginClasspath() throws MojoExecutionException
{
try
{
- List provided = new ArrayList();
- URL[] urls = null;
+ List provided = new ArrayList<>();
+ URL[] urls;
- for ( Iterator iter = projectArtifacts.iterator(); iter.hasNext(); )
- {
- Artifact artifact = iter.next();
+ for (Artifact artifact : projectArtifacts) {
if (Artifact.SCOPE_PROVIDED.equals(artifact.getScope()) && !isPluginArtifact(artifact))
{
provided.add(artifact.getFile().toURI().toURL());
@@ -393,10 +387,6 @@ public void configurePluginClasspath() throws MojoExecutionException
- /**
- * @param artifact
- * @return
- */
public boolean isPluginArtifact(Artifact artifact)
{
if (pluginArtifacts == null || pluginArtifacts.isEmpty())
@@ -417,14 +407,11 @@ public boolean isPluginArtifact(Artifact artifact)
- /**
- * @throws Exception
- */
public void finishConfigurationBeforeStart() throws Exception
{
- HandlerCollection contexts = (HandlerCollection)server.getChildHandlerByClass(ContextHandlerCollection.class);
+ HandlerCollection contexts = server.getChildHandlerByClass(ContextHandlerCollection.class);
if (contexts==null)
- contexts = (HandlerCollection)server.getChildHandlerByClass(HandlerCollection.class);
+ contexts = server.getChildHandlerByClass(HandlerCollection.class);
for (int i=0; (this.contextHandlers != null) && (i < this.contextHandlers.length); i++)
{
@@ -435,9 +422,6 @@ public void finishConfigurationBeforeStart() throws Exception
- /**
- * @throws Exception
- */
public void applyJettyXml() throws Exception
{
if (getJettyXmlFiles() == null)
@@ -448,9 +432,6 @@ public void applyJettyXml() throws Exception
- /**
- * @throws MojoExecutionException
- */
public void startJetty () throws MojoExecutionException
{
try
@@ -579,8 +560,6 @@ public void configureMonitor()
/**
* Subclasses should invoke this to setup basic info
* on the webapp
- *
- * @throws MojoExecutionException
*/
public void configureWebApplication () throws Exception
{
@@ -612,8 +591,9 @@ public void configureWebApplication () throws Exception
{
File target = new File(project.getBuild().getDirectory());
File tmp = new File(target, "jetty");
- if (!tmp.exists())
- tmp.mkdirs();
+ if (!Files.isDirectory(tmp.toPath())) {
+ Files.createDirectories(tmp.toPath());
+ }
webApp.setTempDirectory(tmp);
}
@@ -687,10 +667,7 @@ protected void printSystemProperties ()
{
if (systemProperties != null)
{
- Iterator itor = systemProperties.getSystemProperties().iterator();
- while (itor.hasNext())
- {
- SystemProperty prop = (SystemProperty)itor.next();
+ for (SystemProperty prop : systemProperties.getSystemProperties()) {
getLog().debug("Property "+prop.getName()+"="+prop.getValue()+" was "+ (prop.isSet() ? "set" : "skipped"));
}
}
@@ -703,7 +680,6 @@ protected void printSystemProperties ()
/**
* Try and find a jetty-web.xml file, using some
* historical naming conventions if necessary.
- * @param webInfDir
* @return the jetty web xml file
*/
public File findJettyWebXmlFile (File webInfDir)
@@ -728,10 +704,6 @@ public File findJettyWebXmlFile (File webInfDir)
- /**
- * @param file
- * @throws Exception
- */
public void setSystemPropertiesFile(File file) throws Exception
{
this.systemPropertiesFile = file;
@@ -760,9 +732,6 @@ public void setSystemPropertiesFile(File file) throws Exception
- /**
- * @param systemProperties
- */
public void setSystemProperties(SystemProperties systemProperties)
{
if (this.systemProperties == null)
@@ -782,9 +751,6 @@ public void setSystemProperties(SystemProperties systemProperties)
- /**
- * @return
- */
public List getJettyXmlFiles()
{
if ( this.jettyXml == null )
@@ -792,7 +758,7 @@ public List getJettyXmlFiles()
return null;
}
- List jettyXmlFiles = new ArrayList();
+ List jettyXmlFiles = new ArrayList<>();
if ( this.jettyXml.indexOf(',') == -1 )
{
@@ -813,10 +779,6 @@ public List getJettyXmlFiles()
- /**
- * @param goal
- * @return
- */
public boolean isExcluded (String goal)
{
if (excludedGoals == null || goal == null)
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/Artifacts.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/Artifacts.java
index c51ddddbdc..1a34bb8f72 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/Artifacts.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/Artifacts.java
@@ -1,14 +1,13 @@
package org.jenkinsci.maven.plugins.hpi;
-import com.google.common.base.Predicate;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
+import java.util.function.Predicate;
/**
* Collection filter operations on a set of {@link Artifact}s.
@@ -37,90 +36,52 @@ public static Artifacts ofDirectDependencies(MavenProject p) {
}
public Artifacts retainAll(Predicate filter) {
- for (Iterator itr = iterator(); itr.hasNext(); ) {
- if (!filter.apply(itr.next()))
- itr.remove();
- }
+ removeIf(artifact -> !filter.test(artifact));
return this;
}
public Artifacts removeAll(Predicate filter) {
- for (Iterator itr = iterator(); itr.hasNext(); ) {
- if (filter.apply(itr.next()))
- itr.remove();
- }
+ removeIf(filter);
return this;
}
public Artifacts scopeIs(String... scopes) {
final List s = Arrays.asList(scopes);
- return retainAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getScope());
- }
- });
+ return retainAll(a -> s.contains(a.getScope()));
}
public Artifacts scopeIsNot(String... scopes) {
final List s = Arrays.asList(scopes);
- return removeAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getScope());
- }
- });
+ return removeAll(a -> s.contains(a.getScope()));
}
public Artifacts typeIs(String... type) {
final List s = Arrays.asList(type);
- return retainAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return retainAll(a -> s.contains(a.getType()));
}
public Artifacts typeIsNot(String... type) {
final List s = Arrays.asList(type);
- return removeAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return removeAll(a -> s.contains(a.getType()));
}
public Artifacts groupIdIs(String... groupId) {
final List s = Arrays.asList(groupId);
- return retainAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return retainAll(a -> s.contains(a.getType()));
}
public Artifacts groupIdIsNot(String... groupId) {
final List s = Arrays.asList(groupId);
- return removeAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return removeAll(a -> s.contains(a.getType()));
}
public Artifacts artifactIdIs(String... artifactId) {
final List s = Arrays.asList(artifactId);
- return retainAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return retainAll(a -> s.contains(a.getType()));
}
public Artifacts artifactIdIsNot(String... artifactId) {
final List s = Arrays.asList(artifactId);
- return removeAll(new Predicate() {
- public boolean apply(Artifact a) {
- return s.contains(a.getType());
- }
- });
+ return removeAll(a -> s.contains(a.getType()));
}
}
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AssembleDependenciesMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AssembleDependenciesMojo.java
index 2110c2f3a9..58f0797c79 100644
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AssembleDependenciesMojo.java
+++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AssembleDependenciesMojo.java
@@ -58,7 +58,7 @@ public class AssembleDependenciesMojo extends AbstractDependencyGraphTraversingM
private List parsedScopes;
- private final Map hpis = new HashMap();
+ private final Map hpis = new HashMap<>();
@Override
protected boolean accept(DependencyNode g) {
@@ -85,11 +85,12 @@ protected boolean accept(DependencyNode g) {
}
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
hpis.clear();
- parsedScopes = new ArrayList();
+ parsedScopes = new ArrayList<>();
parsedScopes.add(null); // this is needed to traverse the root node
for (String s : scopes.split(",")) {
parsedScopes.add(s.trim());
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/BundlePluginsMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/BundlePluginsMojo.java
deleted file mode 100644
index 309626089d..0000000000
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/BundlePluginsMojo.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package org.jenkinsci.maven.plugins.hpi;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.shared.artifact.filter.collection.AbstractArtifactsFilter;
-import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Take the current project, list up all the transitive dependencies, then copy them
- * into a specified directory.
- *
- *
- * Used to assemble {@code jenkins.war} by bundling all the necessary plugins.
- *
- * @author Stephen Connolly
- */
-@Mojo(name = "bundle-plugins",
- defaultPhase = LifecyclePhase.PREPARE_PACKAGE,
- requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
- requiresProject = true,
- threadSafe = true
-)
-public class BundlePluginsMojo extends AbstractJenkinsMojo {
- /**
- * Where to copy plugins into.
- */
- @Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}/WEB-INF/plugins/")
- private File outputDirectory;
-
- /**
- * Where to copy optional plugins into.
- * @see optional-plugin-helper-module
- */
- @Parameter(defaultValue = "${project.build.directory}/${project.build.finalName}/WEB-INF/optional-plugins/")
- private File optionalOutputDirectory;
-
- /**
- * By default the build will fail if one of the bundled plugins has an optional dependency on a newer version
- * of another bundled plugin.
- */
- @Parameter(property = "hpi.ignoreOptionalDependencyConflicts")
- private boolean ignoreOptionalDependencyConflicts;
-
- @Component
- protected ArtifactResolver resolver;
-
- @Component
- protected ArtifactCollector artifactCollector;
-
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- Set badDependencies = new LinkedHashSet();
- for (Artifact a: (Set)project.getDependencyArtifacts()) {
- try {
- if (StringUtils.isBlank(a.getType()) || StringUtils.equals("jar", a.getType()) && wrap(a).isPlugin()) {
- final String gav = String.format("%s:%s:%s", a.getGroupId(), a.getArtifactId(), a.getVersion());
- getLog().error(String.format("Dependency on plugin %s does not include tag", gav));
- badDependencies.add(gav);
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Failed to check plugin dependencies", e);
- }
- }
- if (!badDependencies.isEmpty()) {
- throw new MojoFailureException(
- "The following plugin dependencies are missing the tag required by the bundle-plugins "
- + "goal:\n " + StringUtils.join(badDependencies, "\n "));
- }
- TypeFilter typeFilter = new TypeFilter("hpi,jpi", null);
- // the HPI packaging type is brain-dead... since nobody lists plugin dependencies with hpi
- // we loose all transitive information, so we need to throw away all the good stuff maven would give us
- // further we need to set provided in order to keep this off the classpath as then
- // the war plugin would suck them in anyways
- Set artifacts = typeFilter.filter(project.getDependencyArtifacts());
- artifacts = typeFilter.filter(artifacts);
- Set nonOptionalArtifacts = new OptionalFilter(false).filter(artifacts);
- try {
- // This would be unnecessary and trivial if the hpi packaging was defined correctly
- ArtifactResolutionResult r = resolver.resolveTransitively(artifacts, project.getArtifact(), remoteRepos, localRepository, artifactMetadataSource);
- ArtifactResolutionResult noR = resolver.resolveTransitively(nonOptionalArtifacts, project.getArtifact(), remoteRepos, localRepository, artifactMetadataSource);
-
- List hpis = new ArrayList();
-
-
- // resolveTransitively resolves items in the 'all' set individually,
- // so there will be duplicates and multiple versions
- // we need to select the latest
- Map selected = new HashMap();
-
- // first we want to take all the dependencies as a complete set
-
- for (Artifact o : (Set)r.getArtifacts()) {
- MavenArtifact a = wrap(o);
- if (a.isPlugin()) {
- MavenArtifact cur = selected.get(a.getArtifactId());
- if (cur != null) {
- if (cur.getVersionNumber().compareTo(a.getVersionNumber()) < 0) {
- cur = a;
- }
- } else {
- cur = a;
- }
- selected.put(a.getArtifactId(), cur);
- }
- }
-
- // now just take the non-optional ones (these may have a higher minimum versions when we exclude the optional ones)
- // (due to the ordering effect of dependencies when resolving conflicts in case you were wondering)
-
- Set nonOptional = new HashSet();
- for (Artifact o: (Set)noR.getArtifacts()) {
- MavenArtifact a = wrap(o);
- if (a.isPlugin()) {
- nonOptional.add(o.getArtifactId());
- MavenArtifact cur = selected.get(a.getArtifactId());
- if (cur != null) {
- if (cur.getVersionNumber().compareTo(a.getVersionNumber()) < 0) {
- cur = a;
- }
- } else {
- cur = a;
- }
- selected.put(a.getArtifactId(), cur);
- }
- }
-
- // now we just need to check if the optional dependencies have issues
- // in theory we do not need to fail the build if a transitive dependency has issues
- // we could just up-version it, but that would put us back to the start in terms of dependency resolution
- // so much simpler to force the user to explicitly resolve the conflict by adding an explicit
- // dependency
-
- Set optionalDependencyIssue = new LinkedHashSet();
- for (MavenArtifact a: selected.values()) {
- try {
- final MavenProject pom = a.resolvePom();
- for (Dependency d : (List)pom.getDependencies()) {
- if (!d.isOptional()) continue;
- if (!selected.containsKey(d.getArtifactId())) continue;
- MavenArtifact matching = selected.get(d.getArtifactId());
- if (!StringUtils.equals(d.getGroupId(), matching.getGroupId())) continue;
- if (matching.getVersionNumber().compareTo(new DefaultArtifactVersion(d.getVersion())) < 0) {
- final String message = String.format(
- "%s: optional dependency of %s version %s conflicts with the bundled version %s",
- a.getArtifactId(), d.getArtifactId(), d.getVersion(), matching.getVersion());
- getLog().error(message);
- optionalDependencyIssue.add(message);
- }
- }
- } catch (ProjectBuildingException e) {
- getLog().warn(String.format("Could not resolve pom of %s:%s:%s to check optional dependencies",
- a.getGroupId(), a.getArtifactId(), a.getVersion()), e);
- }
- }
- if (!optionalDependencyIssue.isEmpty()) {
- if (ignoreOptionalDependencyConflicts) {
- getLog().warn("Ignoring optional dependency conflicts");
- } else {
- throw new MojoFailureException(
- "Optional dependencies are incompatible with bundled dependencies:\n " + StringUtils
- .join(optionalDependencyIssue, "\n "));
- }
- }
-
- outputDirectory.mkdirs();
- if (!nonOptional.containsAll(selected.keySet())) {
- optionalOutputDirectory.mkdirs();
- }
-
- int artifactIdLength = "Artifact ID".length(); // how many chars does it take to print artifactId?
- int groupIdLength = "Group ID".length(); // how many chars does it take to print groupId?
- int versionLength = "Version".length();
- for (MavenArtifact a : selected.values()) {
- MavenArtifact hpi = a.getHpi();
- getLog().debug("Copying " + hpi.getFile());
-
-
- FileUtils.copyFile(hpi.getFile(),
- new File(nonOptional.contains(hpi.getArtifactId()) ? outputDirectory : optionalOutputDirectory,
- hpi.getArtifactId() + ".hpi")
- );
- hpis.add(hpi);
- artifactIdLength = Math.max(artifactIdLength, hpi.getArtifactId().length());
- groupIdLength = Math.max(groupIdLength, hpi.getGroupId().length());
- versionLength = Math.max(versionLength, hpi.getVersion().length());
- }
-
- Collections.sort(hpis, new Comparator() {
- public int compare(MavenArtifact o1, MavenArtifact o2) {
- return map(o1).compareTo(map(o2));
- }
-
- private String map(MavenArtifact a) {
- return a.getArtifactId();
- }
- });
-
- File list = new File(project.getBuild().getOutputDirectory(), "bundled-plugins.txt");
- File manifest = new File(project.getBuild().getDirectory(), "plugin-manifest.txt");
- list.getParentFile().mkdirs();
- PrintWriter w = new PrintWriter(list);
- PrintWriter m = new PrintWriter(manifest);
- try {
- final String format = "%" + (-artifactIdLength) + "s %" + (-versionLength) + "s %-8s %"+(-groupIdLength)+"s";
- final String format2 = "%"+(-groupIdLength)+"s %" + (-artifactIdLength) + "s %" + (-versionLength) + "s %-8s%n";
- getLog().info(String.format(format,
- "Artifact ID",
- "Version",
- "Optional",
- "Group ID"));
- m.printf(format2, "Group Id", "Artifact Id", "Version", "Optional");
- m.printf(format2, StringUtils.repeat("=",groupIdLength), StringUtils.repeat("=",artifactIdLength), StringUtils.repeat("=",versionLength), StringUtils.repeat("=",8));
- getLog().info(String.format(format,
- StringUtils.repeat("=", artifactIdLength),
- StringUtils.repeat("=", versionLength),
- StringUtils.repeat("=", 8),
- StringUtils.repeat("=", groupIdLength)));
- for (MavenArtifact hpi : hpis) {
- getLog().info(String.format(format,
- hpi.getArtifactId(),
- hpi.getVersion(),
- nonOptional.contains(hpi.getArtifactId()) ? "" : "optional",
- hpi.getGroupId()));
- m.printf(format2,
- hpi.getGroupId(),
- hpi.getArtifactId(),
- hpi.getVersion(),
- nonOptional.contains(hpi.getArtifactId()) ? "no" : "yes"
- );
- w.println(hpi.getId());
- }
- } finally {
- IOUtils.closeQuietly(w);
- IOUtils.closeQuietly(m);
- }
-
- projectHelper.attachArtifact(project, "txt", "bundled-plugins", list);
- projectHelper.attachArtifact(project, "txt", "plugin-manifest", manifest);
- } catch (ArtifactResolutionException e) {
- throw new MojoExecutionException("Failed to resolve plugin dependencies", e);
- } catch (ArtifactNotFoundException e) {
- throw new MojoExecutionException("Failed to resolve plugin dependencies", e);
- } catch (IOException e) {
- throw new MojoExecutionException("Failed to resolve plugin dependencies", e);
- }
- }
-
- private static class OptionalFilter extends AbstractArtifactsFilter {
- private final boolean optional;
-
- private OptionalFilter(boolean optional) {
- this.optional = optional;
- }
-
- public Set filter(Set artifacts) {
- Set result = new LinkedHashSet();
- for (Artifact a: (Set)artifacts) {
- if (optional == a.isOptional()) {
- result.add(a);
- }
- }
- return result;
- }
- }
-}
diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/CollectionUtils.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/CollectionUtils.java
deleted file mode 100644
index 282779e376..0000000000
--- a/src/main/java/org/jenkinsci/maven/plugins/hpi/CollectionUtils.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.jenkinsci.maven.plugins.hpi;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * Taken from jdk7 Collections
- */
-class CollectionUtils {
-
- public static Enumeration emptyEnumeration() {
- return (Enumeration) EmptyEnumeration.EMPTY_ENUMERATION;
- }
-
- private static class EmptyEnumeration implements Enumeration {
- static final EmptyEnumeration