Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28629

Fix Apache Maven 3.3 support

XMLWordPrintable

    • 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

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

              Created:
              Updated:
              Resolved: