Skip to end of metadata
Go to start of metadata

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.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 - Getting issue details... STATUS  ) - 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 - Getting issue details... STATUS  )

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 - Getting issue details... STATUS  )
  • (tick) Fixed: Forbid nested references to model objects (  JENKINS-45892 - Getting issue details... STATUS  )
  • (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)

14 Comments

  1. Where is the source code of this project?

    1. At GitHub; follow the link inside the Plugin Information -> Source Code row

      1. GitHub links all yield 404 errors.  Please fix these.

        1. GitHub link to the source code is fixed now. Unfortunately the links to changes (in latest release/since latest release) don't work, because the maven plugin is part of the jenkins project at GitHub.

  2. I'm not positive, but I think the component is wrong on the bug link.  It says "maven-plugin" but there is no "maven-plugin" component in Jira.  Maybe it should be "maven2"?

  3. I have installed jenkins version 1.434. version 1.434 is listed as an available version of this plugin and says I am using 1.431. I thought the plugin was included in the jenkins.war. Do I need to install the plugin seperately?

  4. Hi, I am not sure if this is the right place or not, please advice me of proper plugin section to post my question. recently i have upgraded to the latest maven 2 project plugin and i have started noticing some issues with builds. randomly i get the below error and tried to add several maven options and no luck . your feedback is greatly appreciated.

    channel stopped
    
    ERROR: Failed to parse POMs
    
    java.io.IOException: Remote call on Channel to Maven [/usr/java/jdk1.6.0_23/bin/java, -Xmx1024m, -Xms512m, -XX:MaxPermSize=512m, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=/usr/local/scm/hudson, -cp, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.2.jar:/usr/local/scm/ci-tools/apache-maven-2.2.1/boot/classworlds-1.1.jar, hudson.maven.agent.Main, /usr/local/scm/ci-tools/apache-maven-2.2.1, /usr/local/scm/hudson/workspace/war/WEB-INF/lib/remoting-2.11.jar, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.2.jar, 40513, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven2.1-interceptor-1.2.jar] failed
    
    at hudson.remoting.Channel.call(Channel.java:690)
    
    at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:156)
    
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:778)
    
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:461)
    
    at hudson.model.Run.run(Run.java:1404)
    
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:470)
    
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    
    at hudson.model.Executor.run(Executor.java:230)
    
    Caused by: java.lang.OutOfMemoryError: PermGen space
    
    channel stopped
    ERROR: Failed to parse POMs
    java.io.IOException: Remote call on Channel to Maven [/usr/java/jdk1.6.0_23/bin/java, -Xmx1024m, -Xms512m, -XX:MaxPermSize=512m, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=/usr/local/scm/hudson, -cp, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.2.jar:/usr/local/scm/ci-tools/apache-maven-2.2.1/boot/classworlds-1.1.jar, hudson.maven.agent.Main, /usr/local/scm/ci-tools/apache-maven-2.2.1, /usr/local/scm/hudson/workspace/war/WEB-INF/lib/remoting-2.11.jar, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.2.jar, 40513, /usr/local/scm/hudson/workspace/plugins/maven-plugin/WEB-INF/lib/maven2.1-interceptor-1.2.jar] failed at hudson.remoting.Channel.call(Channel.java:690) at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:156) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:778) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:461) at hudson.model.Run.run(Run.java:1404) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:470) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230)
    Caused by: java.lang.OutOfMemoryError: PermGen space
    
    1. We have a similar issue with the "REMOTING CAPACITY" failing.  It is a pity the plugin does not show all commands that it runs.  Does it try to start the "REMOTING CAPACITY" daemon on every build run?  I see an error message that appears to come from the "REMOTING CAPACITY" daemon but the console log shows a command connecting to it.

      08:19:13 Parsing POMs
      08:19:14 [dev] $ /usr/java/default/bin/java -Xms512m -Xmx1024m -XX:PermSize=128m -cp /usr/local/jenkins/maven3-agent.jar:/usr/local/jenkins/tools/Maven/maven-3.0.3/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /usr/local/jenkins/tools/Maven/maven-3.0.3 /usr/local/jenkins/slave.jar /usr/local/jenkins/maven3-interceptor.jar 40968
      08:19:14 Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher
      08:19:14 	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
      08:19:14 	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
      08:19:14 	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
      08:19:14 	at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:130)
      08:19:14 	at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:63)
      08:19:14 ERROR: Failed to parse POMs
      08:19:14 java.net.SocketException: Connection reset
      08:19:14 	at java.net.SocketInputStream.read(SocketInputStream.java:168)
      08:19:14 	at java.io.FilterInputStream.read(FilterInputStream.java:116)
      08:19:14 	at hudson.remoting.ProxyInputStream$Buffer.read(ProxyInputStream.java:110)
      08:19:14 	at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:132)
      08:19:14 	at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:119)
      08:19:14 	at hudson.remoting.Request$2.run(Request.java:326)
      08:19:14 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      08:19:14 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      08:19:14 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      08:19:14 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      08:19:14 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      08:19:14 	at java.lang.Thread.run(Thread.java:662)
  5. Please add an option so that a build is considered successful if maven return code is success, just like the one bamboo has.

  6. Hi, 

    is there any way to obtain modules information (for multi-module project) before the maven build step execution of a maven project job ?

    before the first execution of the job, the module list is empty.

    Thanks 

  7. So, I have a maven parent project.  I'm building it using this plugin with the goal string of "package".  The job completes without error (all projects build), but no artifacts are listed on the job page as does with my ant projects.  I took a look at the filesystem and there is a "default" folder created with all sub-projects and their builds.  Is this normal behaviour?  What steps do I need to take to have my artifacts listed on the jobs page?

  8. Hello Team. 

    I was trying to install this plugin using puppet module rtyler-jenkins; The plugin tries to wget --no-check-certificate http://updates.jenkins-ci.org/latest/maven-plugin.hpi

    Apparently is first try to download from http://mirror.xmission.com/jenkins/plugins/maven-plugin/2.12.1/maven-plugin.hpi which take a long time to do so, its stops at 5.1 MB of 10.3 MB. 

    At the end the installation shows 

    error: /Stage[main]/Jenkins_instance/Jenkins::Plugin[maven-plugin]/Exec[download-maven-plugin]/returns: change from notrun to 0 failed: Command exceeded timeout

    Can you please help. Any advice is welcome. 

  9. Version 2.13 (May 19, 2016)
    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.

    No associated JIRA ticket?

    What is the default value? Checked?

  10. Hi,

    is there any chance to fix "triggering of downstream projects"?

    It stopped working since 2.14, works fine in 2.13.

    Tested on jenkins clean install.

    Ticker for this issue:  JENKINS-47021 - Getting issue details... STATUS