• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None
    • 1.619, 1.615 and before

      Apache Maven 3.3(.1) was release in March bringing few new features to its users : http://blog.soebes.de/blog/2015/03/17/apache-maven-3-dot-3-1-features/

      This issue consolidates all problems reported by users to correctly support Apache Maven 3.3.

      • INFRA-181 : The installer from Apache archives doesn't list Maven versions > 3.2.2 (Note also that the crawler used to update the catalog is often broken INFRA-225). The workaround is to deploy it from an URL (from Maven central for example)
      • The Maven Job doesn't support Maven 3.3 (the workaround is to use the freestyle job but it doesn't offer everything that the Maven Job offers)
        • Maven 3.3 needs Java 7
        • .mvn feature is badly implemented on Maven side (a bug will be submitted) which is looking for it in parent of the folder where Maven is executed and not where the pom of the project is located (this problem cannot be visible in 99.99% of cases because you don't use -f option). Thus if you checkout your project in a subdirectory, launch your build with -f myCheckoutDir/pom.xml and have a myCheckoutDir/.mvn directory it won't be used (Maven is launched from the $WORKSPACE directory and this bug/limitation will be the same for freestyle jobs
        • -t and -gt toolchain options aren't correctly passed to Maven and the one from the user directory isn't used anymore (JENKINS-28420)

      Toolchain build in a Jenkins Maven Job

      Started by user anonymous
      Building in workspace /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace
      Parsing POMs
      Modules changed, recalculating dependency graph
      [toolchains] $ java -Xms128M -Xmx1G -cp /Users/arnaud/TestDir/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/Users/arnaud/TestDir/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/Users/arnaud/TestDir/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /Users/arnaud/TestDir/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3/apache-maven-3.3.3 /Users/arnaud/TestDir/jenkins-home/war/WEB-INF/lib/remoting-2.51.jar /Users/arnaud/TestDir/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /Users/arnaud/TestDir/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 64455
      <===[JENKINS REMOTING CAPACITY]===>channel started
      Executing Maven:  -B -f /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/pom-toolchain.xml -t /Users/arnaud/.m2/toolchains-test.xml -V clean package exec:exec javadoc:javadoc
      Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
      Maven home: /Users/arnaud/TestDir/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3/apache-maven-3.3.3
      Java version: 1.7.0_71, vendor: Oracle Corporation
      Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
      [INFO] Scanning for projects...
      [INFO]                                                                         
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Toolchains Demo 0.0.1-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ toolchain ---
      [INFO] 
      [INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ toolchain ---
      [INFO] Required toolchain: jdk [ version='1.6' ]
      [ERROR] No toolchain found for type jdk
      [ERROR] Cannot find matching toolchain definitions for the following toolchain types:
      jdk [ version='1.6' ]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3.895 s
      [INFO] Finished at: 2015-05-28T18:47:57+02:00
      [INFO] Final Memory: 14M/229M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project toolchain: Cannot find matching toolchain definitions for the following toolchain types:
      [ERROR] jdk [ version='1.6' ]
      [ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      [JENKINS] Archiving /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/pom-toolchain.xml to fr.devoxx/toolchain/0.0.1-SNAPSHOT/toolchain-0.0.1-SNAPSHOT.pom
      channel stopped
      Finished: FAILURE
      

      Exactly the same Toolchain build directly with Maven

      arnaud@mbp-arnaud:~/TestDir $ mvn -B -f /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/pom-toolchain.xml -t /Users/arnaud/.m2/toolchains-test.xml -V clean package exec:exec javadoc:javadoc
      Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
      Maven home: /Users/arnaud/Applications/apache-maven-3.3.3
      Java version: 1.7.0_71, vendor: Oracle Corporation
      Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
      [INFO] Scanning for projects...
      [INFO]                                                                         
      [INFO] ------------------------------------------------------------------------
      [INFO] Building Toolchains Demo 0.0.1-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ toolchain ---
      [INFO] Deleting /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/target
      [INFO] 
      [INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ toolchain ---
      [INFO] Required toolchain: jdk [ version='1.6' ]
      [INFO] Found matching toolchain for type jdk: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ toolchain ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/src/main/resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ toolchain ---
      [INFO] Toolchain in compiler-plugin: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/target/classes
      [INFO] 
      [INFO] --- animal-sniffer-maven-plugin:1.14:check (check-java-compat) @ toolchain ---
      [INFO] Checking unresolved references to org.codehaus.mojo.signature:java15:1.0
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ toolchain ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/src/test/resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ toolchain ---
      [INFO] Toolchain in compiler-plugin: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/target/test-classes
      [INFO] 
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ toolchain ---
      [INFO] Toolchain in surefire-plugin: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] Surefire report directory: /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/target/surefire-reports
      
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running toolchains.MainTest
      toolchains.Main running on JVM 1.6
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec
      
      Results :
      
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
      
      [INFO] 
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ toolchain ---
      [INFO] Building jar: /Users/arnaud/TestDir/jenkins-home/jobs/maven3-project/workspace/toolchains/target/toolchain-0.0.1-SNAPSHOT.jar
      [INFO] 
      [INFO] --- exec-maven-plugin:1.4.0:exec (default-cli) @ toolchain ---
      [INFO] Toolchain in exec-maven-plugin: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      toolchains.Main running on JVM 1.6
      [INFO] 
      [INFO] >>> maven-javadoc-plugin:2.10.1:javadoc (default-cli) > generate-sources @ toolchain >>>
      [INFO] 
      [INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ toolchain ---
      [INFO] Required toolchain: jdk [ version='1.6' ]
      [INFO] Found matching toolchain for type jdk: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] 
      [INFO] <<< maven-javadoc-plugin:2.10.1:javadoc (default-cli) < generate-sources @ toolchain <<<
      [INFO] 
      [INFO] --- maven-javadoc-plugin:2.10.1:javadoc (default-cli) @ toolchain ---
      [INFO] Toolchain in javadoc-plugin: JDK[/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 11.806 s
      [INFO] Finished at: 2015-05-28T18:51:10+02:00
      [INFO] Final Memory: 21M/230M
      [INFO] ------------------------------------------------------------------------
      

      The project used for toolchain tests : https://github.com/MavenDevoxxFR2015/demos/tree/master/toolchains

          [JENKINS-28629] Fix Apache Maven 3.3 support

          Maven 3.3 needs Java 7

          As far as the job (maven job or freestyle job) is configured to use Java >= 7 the build is correctly launched even if the master and the slave are launched with Java 6

          Arnaud Héritier added a comment - Maven 3.3 needs Java 7 As far as the job (maven job or freestyle job) is configured to use Java >= 7 the build is correctly launched even if the master and the slave are launched with Java 6

          • freestyle.txt the sample project built with Maven 3.3 and a custom toolchain in a freestyle job
          • mavenJob.txt the sample project built with Maven 3.3 and a custom toolchain in a maven job

          Arnaud Héritier added a comment - freestyle.txt the sample project built with Maven 3.3 and a custom toolchain in a freestyle job mavenJob.txt the sample project built with Maven 3.3 and a custom toolchain in a maven job

          -t and -gt toolchain options aren't correctly passed to Maven and the one from the user directory isn't used anymore (JENKINS-28420)

          A workaround is to use a freestyle job instead of a maven job

          Arnaud Héritier added a comment - -t and -gt toolchain options aren't correctly passed to Maven and the one from the user directory isn't used anymore ( JENKINS-28420 ) A workaround is to use a freestyle job instead of a maven job

          another 3.3 issue specific for windows env

          Arnaud Héritier added a comment - another 3.3 issue specific for windows env

          I didn't reproduced this one. Need to be studied

          Arnaud Héritier added a comment - I didn't reproduced this one. Need to be studied

          I reported MNG-5889 for the problem with the .mvn directory.

          How about adding a "base directory" or "module root directory" setting and to change into that directory before launching Maven?

          Daniel Spilker added a comment - I reported MNG-5889 for the problem with the .mvn directory. How about adding a "base directory" or "module root directory" setting and to change into that directory before launching Maven?

          Tomer Cohen added a comment -

          I opened pull requests that should fix at least the toolchains problem (as this is what is essentially blocking me from upgrading Jenkins to Maven 3.3)

          maven-interceptors: https://github.com/jenkinsci/maven-interceptors/pull/9
          maven-plugin: https://github.com/jenkinsci/maven-plugin/pull/63

          I tested it on my setup and it seems to work as intended. Would appreciate if someone can take a look.

          Thanks a bunch

          Tomer Cohen added a comment - I opened pull requests that should fix at least the toolchains problem (as this is what is essentially blocking me from upgrading Jenkins to Maven 3.3) maven-interceptors: https://github.com/jenkinsci/maven-interceptors/pull/9 maven-plugin: https://github.com/jenkinsci/maven-plugin/pull/63 I tested it on my setup and it seems to work as intended. Would appreciate if someone can take a look. Thanks a bunch

          tcohen thanks a lot for your PR
          I'll review them more deeply tomorrow
          The main point here is that we'll have to bump the compatibility of the plugin to Jenkins OSS >= 1.612 or Jenkins LTS >= 1.625.1 because of J7 required by m3.3
          Not a big issue but I would prefer to release the 2.13 with the current changes we already have and then do a 2.14 (or 3.0) for the 3.3 compat and the J7 requirement. Wdyt olamy ?

          Arnaud Héritier added a comment - tcohen thanks a lot for your PR I'll review them more deeply tomorrow The main point here is that we'll have to bump the compatibility of the plugin to Jenkins OSS >= 1.612 or Jenkins LTS >= 1.625.1 because of J7 required by m3.3 Not a big issue but I would prefer to release the 2.13 with the current changes we already have and then do a 2.14 (or 3.0) for the 3.3 compat and the J7 requirement. Wdyt olamy ?

          Tomer Cohen added a comment -

          aheritier Thank you for looking into this!

          Please let me know what I can do to help.

          Tomer Cohen added a comment - aheritier Thank you for looking into this! Please let me know what I can do to help.

          Tests are passing thus I propose to merge the PR and to iterate to fix existing bugs before the release.

          https://jenkins.ci.cloudbees.com/job/plugins/job/maven-plugin/237/

          WDYT ? (FYI @olamy is working on the test framework which should ease to manage them)

          If you are interested by this fix you can give a try to this SNAPSHOT :
          https://jenkins.ci.cloudbees.com/job/plugins/job/maven-plugin/237/org.jenkins-ci.main$maven-plugin/artifact/org.jenkins-ci.main/maven-plugin/2.14-SNAPSHOT/maven-plugin-2.14-SNAPSHOT.hpi

          Arnaud Héritier added a comment - Tests are passing thus I propose to merge the PR and to iterate to fix existing bugs before the release. https://jenkins.ci.cloudbees.com/job/plugins/job/maven-plugin/237/ WDYT ? (FYI @olamy is working on the test framework which should ease to manage them) If you are interested by this fix you can give a try to this SNAPSHOT : https://jenkins.ci.cloudbees.com/job/plugins/job/maven-plugin/237/org.jenkins-ci.main$maven-plugin/artifact/org.jenkins-ci.main/maven-plugin/2.14-SNAPSHOT/maven-plugin-2.14-SNAPSHOT.hpi

          I submitted a pull request to fix the Maven shell scripts to properly handle finding the correct .mvn directory when passing the file argument. No one seems to be looking at it from the Maven side...

          See MNG-5889

          Robert Patrick added a comment - I submitted a pull request to fix the Maven shell scripts to properly handle finding the correct .mvn directory when passing the file argument. No one seems to be looking at it from the Maven side... See MNG-5889

          Code changed in jenkins
          User: Arnaud HERITIER
          Path:
          pom.xml
          http://jenkins-ci.org/commit/maven-plugin/2ba218bda274cb5d5b561aeada8678d52bd7c26d
          Log:
          Use maven-interceptors 1.8.1
          Fixed: Apache Maven 3.3 support and toolchains integration ( JENKINS-28629, JENKINS-28420 )

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Arnaud HERITIER Path: pom.xml http://jenkins-ci.org/commit/maven-plugin/2ba218bda274cb5d5b561aeada8678d52bd7c26d Log: Use maven-interceptors 1.8.1 Fixed: Apache Maven 3.3 support and toolchains integration ( JENKINS-28629 , JENKINS-28420 )

          Should be fixed in 2.14
          The problem with -f and .mvn folders is an issue on maven side

          Arnaud Héritier added a comment - Should be fixed in 2.14 The problem with -f and .mvn folders is an issue on maven side

          Maven core extensions are still not working in a Maven project even with Maven Integration plugin 2.14 and apache-maven-3.4.0-20161124.073639-240, which has a fix for https://issues.apache.org/jira/browse/MNG-5889

          Jakub Bochenski added a comment - Maven core extensions are still not working in a Maven project even with Maven Integration plugin 2.14 and apache-maven-3.4.0-20161124.073639-240 , which has a fix for https://issues.apache.org/jira/browse/MNG-5889

          Maven extensions + Maven Job ? From my POV (cc @olamy) it's not possible to have this supported. It should require load these extensions in the pom resolution which is done by jenkins (and thus with its classloader which isn't really allowing dynamic updates). From my POV it can work only in classical freestyle jobs where we don't have the advanced integration.

          Arnaud Héritier added a comment - Maven extensions + Maven Job ? From my POV (cc @olamy) it's not possible to have this supported. It should require load these extensions in the pom resolution which is done by jenkins (and thus with its classloader which isn't really allowing dynamic updates). From my POV it can work only in classical freestyle jobs where we don't have the advanced integration.

          Jakub Bochenski added a comment - - edited

          > From my POV it can work only in classical freestyle jobs where we don't have the advanced integration.
          I don't think it's a matter of POV when the plugin claims to provide "advanced integration for Maven 2/3 projects" with no information about it's many incompatibilities.

          Please inform people clearly what they are getting into. This might "discourage people from using the Maven project type" but I think it's better than setting wrong expectations.

          Jakub Bochenski added a comment - - edited > From my POV it can work only in classical freestyle jobs where we don't have the advanced integration. I don't think it's a matter of POV when the plugin claims to provide "advanced integration for Maven 2/3 projects" with no information about it's many incompatibilities. Please inform people clearly what they are getting into. This might "discourage people from using the Maven project type" but I think it's better than setting wrong expectations.

          Jakub Bochenski added a comment - - edited

          > It should require load these extensions in the pom resolution which is done by jenkins (and thus with its classloader which isn't really allowing dynamic updates).
          The extensions doesn't work even if I put them in the Maven installation under lib/ext so I don't think it's about dynamic class loading – static isn't working either

          Jakub Bochenski added a comment - - edited > It should require load these extensions in the pom resolution which is done by jenkins (and thus with its classloader which isn't really allowing dynamic updates). The extensions doesn't work even if I put them in the Maven installation under lib/ext so I don't think it's about dynamic class loading – static isn't working either

          Jakub Bochenski added a comment - - edited

          Looking for some workarounds I wonder:

          • will -Dmaven.ext.class.path work?
          • will modifying maven33-agent.jar or maven33-interceptor.jar or maven3-interceptor-commons.jar?
          • will putting it under lib instead of lib/ext work?
          • is there any way to load the extensions by modifying the Maven installation (e.g. it seems conf/logging is on the classpath too)?
          • is there any way to load EventSpy clients at all, even globally for the whole Jenkins?
          • are build extensions (https://maven.apache.org/guides/mini/guide-using-extensions.html) supported?

          Jakub Bochenski added a comment - - edited Looking for some workarounds I wonder: will -Dmaven.ext.class.path work? will modifying maven33-agent.jar or maven33-interceptor.jar or maven3-interceptor-commons.jar ? will putting it under lib instead of lib/ext work? is there any way to load the extensions by modifying the Maven installation (e.g. it seems conf/logging is on the classpath too)? is there any way to load EventSpy clients at all, even globally for the whole Jenkins? are build extensions ( https://maven.apache.org/guides/mini/guide-using-extensions.html ) supported?

          I would prefer to continue to discuss about the lack of support of maven extensions in JENKINS-30058

          Here the problem .mvn folders support in 3.3.x should be fixed by using maven 3.5.x. But I agree that extensions defined outside of POMs aren't supported 

          Arnaud Héritier added a comment - I would prefer to continue to discuss about the lack of support of maven extensions in  JENKINS-30058 Here the problem .mvn folders support in 3.3.x should be fixed by using maven 3.5.x. But I agree that extensions defined outside of POMs aren't supported 

          > Here the problem .mvn folders support in 3.3.x should be fixed by using maven 3.5.x. But I agree that extensions defined outside of POMs aren't supported
          aheritier sorry I don't follow. What is being fixed by using maven 3.5.x if "extensions defined outside of POMs aren't supported"?

          Jakub Bochenski added a comment - > Here the problem .mvn folders support in 3.3.x should be fixed by using maven 3.5.x. But I agree that extensions defined outside of POMs aren't supported aheritier sorry I don't follow. What is being fixed by using maven 3.5.x if "extensions defined outside of POMs aren't supported"?

          jbochenski what is fixed it is https://issues.apache.org/jira/browse/MNG-5889 which prevented to use .mvn with -f  and the Maven job automatically uses -f thus if you don't have your main pom in the workspace root folder the .mvn folder wasn't used.

          Extensions defined outside of POMs (from the lib/ext folder for instance) were already not supported and it's not specific to 3.3.x+

          Arnaud Héritier added a comment - jbochenski what is fixed it is  https://issues.apache.org/jira/browse/MNG-5889  which prevented to use .mvn with -f  and the Maven job automatically uses -f thus if you don't have your main pom in the workspace root folder the .mvn folder wasn't used. Extensions defined outside of POMs (from the lib/ext folder for instance) were already not supported and it's not specific to 3.3.x+

            aheritier Arnaud Héritier
            aheritier Arnaud Héritier
            Votes:
            14 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: