Jenkins : Maven Project Plugin

Plugin Information

View Maven Integration on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

Maven jobs and Java versions compatibility : Because java serialized classes are exchanged between Jenkins master and Maven Jobs it is required that the JVM used to launch Maven is superior or equal to the version of Java for which Jenkins Master is built for.

  • Jenkins >= 1.520 requires Java 6 thus Maven jobs must be launched with Java >= 6.
  • Jenkins >= 1.612 requires Java 7 thus Maven jobs must be launched with Java >= 7.
  • Jenkins >= 2.54 requires Java 8 thus Maven jobs must be launched with Java >= 8.

See also JENKINS-18403, JENKINS-28294

If Jenkins detects that you are trying to use a JDK older than the master prerequisite, it automatically reconfigure your build to use the JDK on which your agent is running. It displays in your build logs a message like :

ERROR: ================================================================================
ERROR: Invalid project setup: hudson/maven/AbstractMavenProcessFactory$ConfigureOriginalJDK : Unsupported major.minor version 51.0
ERROR: [JENKINS-18403][JENKINS-28294] JDK 'j6' not supported to run Maven projects.
ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the master.
ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
ERROR: Retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/.
ERROR: ================================================================================

But due to the remoting upgrade in Jenkins 2.27+ this workaround doesn't work anymore if your agent or maven job is using Java < 7 - JENKINS-40990 (Because remoting is compiled for Java 7)

Known issues are listed in Jira.

Historically this plugin was released alongside Jenkins core releases. Since version 2.0 this plugin is released separately, but still bundled with Jenkins - though not always the newest version of the plugin might be bundled.

This plugin provides an advanced integration for Maven 2/3 projects.

Even if Jenkins provides natively a Maven builder to use a build step in classical Jenkins jobs (freestyle, ...) this plugin provides a more advanced integration with specific a specific job type providing uniq features like:

  • Automatic configuration of reporting plugins (Junit, Findbugs, ...)
  • Automatic triggering across jobs based on SNAPSHOTs published/consumed
  • Incremental build - only build changed modules
  • Build modules in parallel on multiple executors/nodes
  • Post build deployment of binaries only if the project succeeded and all tests passed
  • ...

See Building a maven2 project for more information on how to use this.

Environment Variables

This plugin exposes variables found from the project's POM (as of version 2.1):

  • POM_DISPLAYNAME
  • POM_VERSION
  • POM_GROUPID
  • POM_ARTIFACTID
  • POM_PACKAGING

And many others features provided by Jenkins plugins ecosystem

Release Notes

Version 3.4 (July 31st, 2019)

Version 3.3 (June 14th, 2019)

  • (tick) Fixed: maven-plugin random socket leak, leading to threads leak on slave and master (JENKINS-57119)
  • (tick) Fixed: java.io.NotSerializableException: The calling thread Thread has no associated channel (JENKINS-57244)
  • (tick) Fixed: Upgrade maven embedder from 3.1.0 to at least 3.5.4 (JENKINS-54530)

Version 3.2 (November 30th, 2018)

Version 3.1.2 (March 27th, 2018)

  • (tick) Fixed: JEP-200 failure to serialize Notifier, used when <ciManagement> specifies email configuration. (  JENKINS-50251 - Rejected: org.apache.maven.model.Notifier Resolved  ) - Take 2 - fix a potential NPE

Version 3.1.1 (March 25th, 2018)

  • (tick) Fixed: JEP-200 failure to serialize Notifier, used when <ciManagement> specifies email configuration. (  JENKINS-50251 - Rejected: org.apache.maven.model.Notifier Resolved  )

Version 3.1 (January 24th, 2018)

  • (tick) Fixed: the perform method should be passing the loop-variable 'moduleBuild' to tdp.getTestData ( PR#12 )
  • (tick) Fixed: UnsupportedOperationException: Refusing to marshal org.apache.maven.artifact.versioning.DefaultArtifactVersion for security reasons ( JENKINS-49089 - UnsupportedOperationException: Refusing to marshal org.apache.maven.artifact.versioning.DefaultArtifactVersion for security reasons Resolved  )
  • (tick) Fixed: Forbid nested references to model objects (  JENKINS-45892 - Forbid nested references to model objects Resolved  )
  • (info) Internal: Update to Apache HttpComponents Client API 4.5.3-2.1
  • (info) Internal: Update Lib Maven Embedder to 3.13
  • Includes: PR#12PR#105PR#106PR#108PR#109PR#111PR#112

Version 3.0 (October 6th, 2017)

  • (tick) Fixed: Global environment variables are not being resolved in Email Notification Recipients list for maven 2/3 projects (JENKINS-13277)
  • (tick) Fixed: Allow to automatically trigger jobs when a project import the dependencyManagement of another (JENKINS-15883)
  • (info) Internal: Update HttpClient and use the client from Apache HttpComponents Client 4.x API Plugin (JENKINS-46053, JENKINS-46210)
  • (info) Internal: Use the JSch library from the JSch Plugin
  • (info) Internal: Fix Parent POM (JENKINS-45271)
  • (info) Internal: Maven Plugin uses obsolete maven methods (JENKINS-46148)
  • (tick) Stop bundling libraries, which are provided by the core (e.g. Guava)
    • Note that some of the changes may lead to compatibility issues in the plugiin dependencies

Version 2.17 (July 10, 2017)

  • (tick) Fixed: Maven version detection fails on same agent with 'java.lang.IllegalStateException: zip file closed' exception.
    Update the Maven Embedder Lib to 3.12.1 :
    • JENKINS-42549 - Prevent file access errors in JARUrlConnection due to the parallel reading of JAR resources in MavenEmbedderUtils#getMavenVersion() (regression in 3.12)
    • JENKINS-40621 - Prevent leaked file descriptors when invoking MavenEmbedderUtils#getMavenVersion()(PR #5)
  • (info) Update: Update plugin description in the plugin manager ( Maven plugin is not being installed by default starting from Jenkins 2 ) ( PR#99 )
  • (info) Update: Remove the message about jenkinsci-users ML ( PR#97 )

Version 2.16 (June 08, 2017)

  • (tick) Fixed: Support of Maven 3.5 (due to non backward compatible change in Apache Maven 3.5) ( JENKINS-43446)
  • (tick) Fixed: fix typo in image sources (JENKINS-42833)

Version 2.15.1 (Feb 16, 2017)

  • (tick) Fixed: Maven projects using Maven 3.0.x don't show annotations in console log since 2.44 / 2.32.2 ( JENKINS-41636, SECURITY-382 )
  • (tick) Fixed: Prevent leaked file descriptors when invoking MavenEmbedderUtils#getMavenVersion() ( JENKINS-40621 )
  • (tick) Fixed: NullPointerException when Jenkins uses by error the Maven 3.2.x launcher with a project using Maven 3.3.x ( JENKINS-41761 )
  • (tick) Fixed: StackOverflowError when parsing Maven POM ( JENKINS-41697, JENKINS-42183 ). It seems to impact only users of Jenkins >= LTS 2.32.1 (and thus probably users of weekly releases >= 2.28 where guice was upgraded to version 4.0 final)
  • (info) Update: Use Apache Maven Owl logo instead of the Apache Feather ( We don't have the rights ) ( JENKINS-38960 )
  • (info) Internal: Fix tests for Jenkins 2, use a minimum set of permalinks instead of a fixed set ( JENKINS-40949 )
  • (info) Internal: Update dependencies
    • Do not bundle Guice (we pick it up from core).
    • Update Sonatype Aether 0.9.0.M2 to Eclipse Aether 1.1.0
    • Update Apache Wagon 2.4 to 2.12 which solves various issues (like SNI support - JENKINS-40903, JENKINS-38738 ) to download dependencies in Parsing POM or upload artifacts from the post build deployment task.
    • Internal: Upgrade lib-jenkins-maven-embedder 3.11 to 3.12

Version 2.15 (Feb 16, 2017)

Release failed .... thx repo.jenkins-ci.org

Version 2.14 (Oct 18, 2016)

Requires now Jenkins >= 1.625.3 and Java >= 7

  • (tick) Fixed: Failed maven builds using -T are showing up as Aborted ( JENKINS-24832 )
  • (tick) Fixed: Apache Maven 3.3 support and toolchains integration ( JENKINS-28629, JENKINS-28420 )
  • (tick) Fixed: Option "Schedule build when some upstream has no successful builds" is never saved ( JENKINS-37937 )
  • (tick) Fixed: With Jenkins 2.x Maven configuration screen is linking to the wrong configuration page when you have no maven installation configured ( JENKINS-38923, JENKINS-36068, JENKINS-34743 )
  • (tick) Fixed: Release builds should not trigger downstream projects ( JENKINS-34789 )
  • (tick) Fixed: Redeploy publisher must reuse global maven settings from the slave ( JENKINS-27161 )
  • (tick) Fixed: Misleading "JDK 5 not supported with Maven" error with Jenkins >= 1.612 and JDK 6 ( JENKINS-28294 )
  • (plus) New: Automatically detect tests from com.simpligility.maven.plugins:android-maven-plugin:internal-integration-test
  • (info) Update: NL translation for MavenProbeAction.DisplayName
  • (info) Internal: Remove usage of IOException2
  • (info) Internal: Upgrade Sisu to 0.3.3 ( JENKINS-38736 )

Version 2.13 (May 19, 2016)

  • JENKINS-31162 New item categorization and dynamic choice offering
  • JENKINS-33387 Transient actions aren't displayed in Maven Jobs
  • JENKINS-31258 Jenkins Maven plug-in ignores JUnit-format test results from unknown Maven plug-ins
  • JENKINS-31524 SurefireArchiver ignores updated results when multiple testing plug-ins use the same reports directory (See Building a maven2 project - Maven Surefire Test Results)
  • JENKINS-28147 Perform Environment tearDown if BuildWrapper fails
  • JENKINS-7010 Maven settings configured at Maven job level aren't used inside the promotion step
  • JENKINS-4428 MavenProbeAction exposes password parameters
  • JENKINS-32635 New option ignoreUnsuccessfulUpstreams. If checked, Jenkins will schedule build even if some upstream project has no successful builds. If not checked, Jenkins will not schedule build when some SNAPSHOT if any other upstream project has no successful builds on this Jenkins.

Version 2.12.1 (Oct 01, 2015)

Version 2.12 (Aug 27, 2015)

  • JENKINS-26947 Forcibly terminate Maven remoting channel when upstream channel is closed.
  • JENKINS-21746 Introduced TcpSocketHostLocator extension point. Using newer interceptors library.

Version 2.11 (Aug 07, 2015)

This version requires Jenkins 1.580.1 or later.

Version 2.10 (Jun 08, 2015)

  • JENKINS-25406 Error running Maven builds including static analysis on new core under some conditions.
  • Improved logging of incremental build behavior.

Version 2.9 (March 18, 2015)

  • nothing special :-) see commits logs

Version 2.8 (Nov 21, 2014)

  • issue #25691 Redeploy link is displayed to Anonymous users with read only permissions for a job

Version 2.7 (Oct 10, 2014)

  • issue #11964 Cannot build a single module in a Maven multi-module job with Maven 3
  • issue #11078 NullPointerException in hudson.maven.Maven3Builder$MavenExecutionListener.recordProjectStarted
  • issue #20884 Variable expansion in maven goals
  • issue #21903 Unless the user has requested to block when upstream is building, do not skip triggering a downstream build just because an upstream is building.
  • issue #4861 Use newer version of transitive plexus-utils dependency that allows to correctly deploy artifacts using scpexe.
  • issue #24282 Use noun phrases for new items
  • run a full build if build was triggered by upstream (snapshot dependency)
  • translation updates

Version 2.6 (Aug 11 2014)

  • JENKINS-23263 Code change to prepare for split of JUnit plugin from core.
  • Better diagnostic logging in case dependency graph calculation fails.
  • JENKINS-23686 New reverse build trigger (1.560+) made to work with a Maven project downstream.
  • Improved checkbox appearance in configuration UI.

Version 2.5 (Jul 11 2014)

  • JENKINS-23098 Deadlocks when running builds with -T (concurrency).

Version 2.4 (Jul 03 2014)

  • Better handle errors from MavenReporter.postExecute.
  • Incorrect root element for module config.xml files.
  • Handling new names for SOAPUI extension.
  • JENKINS-11333 Allow users to disable automatic fingerprinting, but add in explicit fingerprinting if desired.
  • Improved consistency of labels.
  • Localization and help fixes.
  • JENKINS-21014 Include verify lifecycle in upstream candidate calculation.

Version 2.3 (Apr 30 2014)

  • Fixed: Sites for nested Maven multi-modules projects deeper than one level are archived flat issue #22673
  • Fixed: NPE while loading jobs issue #22647

Version 2.2 (Apr 3 2014)

  • Fixed: significant improvements in the Maven build performance JENKINS-22354
  • Fixed: NullPointerException during parsing POM JENKINS-21279
  • Fixed: maven.build.timestamp.format is not obeyed in maven buids JENKINS-9693
  • New: Expose project actions of pre- and post- builders JENKINS-20506
  • New: Use a pop-up dialog instead of extra page for confirmation if user wants to delete all disabled maven modules. (pull request # 17)

Version 2.1 (Dec 17 2013); requires 1.538+

  • Fixed: don't save per-job MAVEN_OPTS if they're the same as the global ones JENKINS-13926
  • New: Expose Maven properties (e.g. GAV) as environment variables JENKINS-18272
  • Fixed: Abort module build when maven build is aborted JENKINS-19801
  • Fixed: Show aggregated failures same way Matrix build does JENKINS-19884
  • Fixed: Maven plugin sends email to 'null' adress JENKINS-20209
  • Fixed: provide better error message if maven_home isn't set JENKINS-20385
  • Fixed: call postBuild after module build completion JENKINS-20487
  • Fixed: Hacks used by MavenMailer to load config.jelly from plain Mailer broke in mailer 1.6 JENKINS-21045
  • New: support for play2-maven-plugin

Version 2.0.4 (Jul 03 2014)

  • JENKINS-11333 Allow users to disable automatic fingerprinting, but add in explicit fingerprinting if desired.

Version 2.0.3 (Jan 28, 2014)

  • Fixed regression in 2.0.2 that RedeployPublisher would delete artifacts from the build after running.

Version 2.0.2 (Jan 23, 2014)

Version 2.0.1 (Jan 04, 2014)

  • Fixed: don't save per-job MAVEN_OPTS if they're the same as the global ones JENKINS-13926
  • New: Expose Maven properties (e.g. GAV) as environment variables JENKINS-18272
  • Fixed: Show aggregated failures same way Matrix build does JENKINS-19884
  • Fixed: Maven plugin sends email to 'null' adress JENKINS-20209
  • Fixed: provide better error message if maven_home isn't set JENKINS-20385
  • Fixed: call postBuild after module build completion JENKINS-20487
  • Fixed: Hacks used by MavenMailer to load config.jelly from plain Mailer broke in mailer 1.6 JENKINS-21045
  • New: support for play2-maven-plugin

Version 2.0 (Oct 22, 2013)

  • Fixed: no errors logged in Jenkins' console if build failed (JENKINS-19352)
  • Fixed: too verbose logging in Maven builds (JENKINS-19396)
  • New: support notifications via the ciManagement section of the POM (JENKINS-1201, JENKINS-6421)
  • Fixed: build may fail if master and slave use different VM types (JENKINS-19978)
  • Fixed: Set the correct status of a maven build, in case that one module has test failures and other module don't compile (JENKINS-16522)

Attachments:

hn.png (image/png)