You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2022/12/12 23:06:31 UTC

[maven] branch maven-3.8.x updated: simplify build and get rid of withMaven (#908)

This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch maven-3.8.x
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/maven-3.8.x by this push:
     new b850b3b5d simplify build and get rid of withMaven (#908)
b850b3b5d is described below

commit b850b3b5d302b03a632276e62da146e199d73056
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Tue Dec 13 08:58:42 2022 +1000

    simplify build and get rid of withMaven (#908)
    
    * simplify build
---
 Jenkinsfile | 47 +++++++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 34e0699ae..5ac9f6e70 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -21,10 +21,10 @@ properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: e
 
 def buildOs = 'linux'
 def buildJdk = '8'
-def buildMvn = '3.6.0'
-def runITsOses = ['linux', 'windows']
-def runITsJdks = ['7', '8', '11','17']
-def runITsMvn = '3.6.0'
+def buildMvn = '3.6.3'
+def runITsOses = ['linux']
+def runITsJdks = ['8', '11', '17']
+def runITsMvn = '3.6.3'
 def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
 def tests
 
@@ -49,24 +49,20 @@ node(jenkinsEnv.nodeSelection(osNode)) {
         stage('Build / Unit Test') {
             String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
             String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
-            withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[
-                artifactsPublisher(disabled: false),
-                junitPublisher(ignoreAttachments: false),
-                findbugsPublisher(disabled: false),
-                openTasksPublisher(disabled: false),
-                dependenciesFingerprintPublisher(),
-                invokerPublisher(),
-                pipelineGraphPublisher()
-            ]) {
-                sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
+            try {
+                withEnv(["JAVA_HOME=${ tool "$jdkName" }",
+                         "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
+                         "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {                   
+                    sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore -PversionlessMavenDist -Dmaven.repo.local=${WORK_DIR}/.repository"
+                }
+            } finally {
+                junit testResults: '**/target/surefire-reports/*.xml', allowEmptyResults: true                
             }
             dir ('apache-maven/target') {
                 sh "mv apache-maven-*-bin.zip apache-maven-dist.zip"
                 stash includes: 'apache-maven-dist.zip', name: 'dist'
             }
         }
-
-        tests = resolveScm source: [$class: 'GitSCMSource', credentialsId: '', id: '_', remote: 'https://gitbox.apache.org/repos/asf/maven-integration-testing.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'GitToolSCMSourceTrait', gitTool: 'Default']]], targets: [BRANCH_NAME, 'master']
     }
 }
 
@@ -89,7 +85,10 @@ for (String os in runITsOses) {
                     // will not trample each other plus workaround for JENKINS-52657
                     dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") {
                         def WORK_DIR=pwd()
-                        checkout tests
+                        checkout([$class: 'GitSCM',
+                                branches: [[name: "*/master"]],
+                                extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
+                                userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])                        
                         if (isUnix()) {
                             sh "rm -rvf $WORK_DIR/apache-maven-dist.zip $WORK_DIR/it-local-repo"
                         } else {
@@ -98,15 +97,10 @@ for (String os in runITsOses) {
                         }
                         unstash 'dist'
                         try {
-                            withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                                junitPublisher(ignoreAttachments: false)
-                            ]) {
-                                String cmd = "${runITscommand} -DmavenDistro=$WORK_DIR/apache-maven-dist.zip -Dmaven.test.failure.ignore=true"
-                                if (stageId.endsWith('-jdk7')) {
-                                    // Java 7u80 has TLS 1.2 disabled by default: need to explicitly enable
-                                    cmd = "${cmd} -Dhttps.protocols=TLSv1.2"
-                                }
-
+                            withEnv(["JAVA_HOME=${ tool "$jdkName" }",
+                                        "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
+                                        "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {                                               
+                                String cmd = "${runITscommand} -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore"
                                 if (isUnix()) {
                                     sh 'df -hT'
                                     sh "${cmd}"
@@ -116,6 +110,7 @@ for (String os in runITsOses) {
                                 }
                             }
                         } finally {
+                            //junit testResults: '**/core-it-suite/**/target/surefire-reports/*.xml', allowEmptyResults: true                                            
                             archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
                                                   'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
                             deleteDir() // clean up after ourselves to reduce disk space