This is an automated email from the ASF dual-hosted git repository. olamy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new 199ed20faf Restore Jenkins build for master (#2151) 199ed20faf is described below commit 199ed20faf07a4caf1efb7280e442fd9ccd62f66 Author: Olivier Lamy <ol...@apache.org> AuthorDate: Sat Mar 15 18:48:18 2025 +1000 Restore Jenkins build for master (#2151) * Restore Jenkinsfile Signed-off-by: Olivier Lamy <ol...@apache.org> --- Jenkinsfile | 85 ++++++++++ disabled-Jenkinsfile | 184 --------------------- disabled-Jenkinsfile.its | 58 ------- disabled-Jenkinsfile.s390x | 171 ------------------- .../maven/it/AbstractMavenIntegrationTestCase.java | 12 ++ .../main/java/org/apache/maven/it/Verifier.java | 12 ++ its/pom.xml | 4 +- pom.xml | 90 +++++++++- 8 files changed, 200 insertions(+), 416 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..87c141ea3c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,85 @@ +#!groovy + +pipeline { + agent none + // save some io during the build + options { + skipDefaultCheckout() + durabilityHint('PERFORMANCE_OPTIMIZED') + //buildDiscarder logRotator( numToKeepStr: '60' ) + disableRestartFromStage() + } + stages { + stage("Parallel Stage") { + parallel { + + stage("Build / Test - JDK17") { + agent { node { label 'ubuntu' } } + steps { + timeout(time: 210, unit: 'MINUTES') { + checkout scm + mavenBuild("jdk_17_latest", "-Djacoco.skip=true") + script { + properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME == 'master' ? '30' : '5'))]) + if (env.BRANCH_NAME == 'master') { + withEnv(["JAVA_HOME=${tool "jdk_17_latest"}", + "PATH+MAVEN=${ tool "jdk_17_latest" }/bin:${tool "maven_3_latest"}/bin", + "MAVEN_OPTS=-Xms4G -Xmx4G -Djava.awt.headless=true"]) { + sh "mvn clean deploy -DdeployAtEnd=true -B" + } + } + } + } + } + } + + stage("Build / Test - JDK21") { + agent { node { label 'ubuntu' } } + steps { + timeout(time: 210, unit: 'MINUTES') { + checkout scm + // jacoco is definitely too slow + mavenBuild("jdk_21_latest", "") // "-Pjacoco jacoco-aggregator:report-aggregate-all" + // recordIssues id: "analysis-jdk17", name: "Static Analysis jdk17", aggregatingResults: true, enabledForFailure: true, + // tools: [mavenConsole(), java(), checkStyle(), errorProne(), spotBugs(), javaDoc()], + // skipPublishingChecks: true, skipBlames: true + // recordCoverage id: "coverage-jdk21", name: "Coverage jdk21", tools: [[parser: 'JACOCO',pattern: 'target/site/jacoco-aggregate/jacoco.xml']], + // sourceCodeRetention: 'MODIFIED', sourceDirectories: [[path: 'src/main/java']] + } + } + } + } + } + } +} + +/** + * To other developers, if you are using this method above, please use the following syntax. + * + * mavenBuild("<jdk>", "<profiles> <goals> <plugins> <properties>" + * + * @param jdk the jdk tool name (in jenkins) to use for this build + * @param extraArgs extra command line args + */ +def mavenBuild(jdk, extraArgs) { + script { + try { + withEnv(["JAVA_HOME=${tool "$jdk"}", + "PATH+MAVEN=${ tool "$jdk" }/bin:${tool "maven_3_latest"}/bin", + "MAVEN_OPTS=-Xms4G -Xmx4G -Djava.awt.headless=true"]) { + sh "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper -Dmaven=3.9.9" + sh "./mvnw clean install -B -U -e -DskipTests -PversionlessMavenDist -V -DdistributionTargetDir=${env.WORKSPACE}/.apache-maven-master" + // we use two steps so that we can cache artifacts downloaded from Maven Central repository + // without installing any local artifacts to not pollute the cache + sh "echo package Its" + sh "./mvnw package -DskipTests -e -B -V -Prun-its -Dmaven.repo.local=${env.WORKSPACE}/.repository/cached" + sh "echo run Its" + sh "./mvnw install -Pci $extraArgs -Dmaven.home=${env.WORKSPACE}/.apache-maven-master -e -B -V -Prun-its -Dmaven.repo.local=${env.WORKSPACE}/.repository/local -Dmaven.repo.local.tail=${env.WORKSPACE}/.repository/cached" + } + } + finally { + junit testResults: '**/target/test-results-surefire/*.xml', allowEmptyResults: true + } + } +} +// vim: et:ts=2:sw=2:ft=groovy diff --git a/disabled-Jenkinsfile b/disabled-Jenkinsfile deleted file mode 100644 index ffe7aa7321..0000000000 --- a/disabled-Jenkinsfile +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'5':'1'))]) - -def buildOs = 'linux' -def buildJdk = '17' -def buildMvn = '3.8.x' -def runITsOses = ['linux'] -def runITsJdks = ['17', '21'] -def runITsMvn = '3.8.x' -def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true -def tests - -try { - -def osNode = jenkinsEnv.labelForOS(buildOs) -node(jenkinsEnv.nodeSelection(osNode)) { - dir('build') { - stage('Checkout') { - checkout scm - } - - def WORK_DIR=pwd() - def MAVEN_GOAL='verify' - - stage('Configure deploy') { - if (env.BRANCH_NAME in ['master', 'maven-3.8.x', 'maven-3.9.x']){ - MAVEN_GOAL='deploy' - } - } - - stage('Build / Unit Test') { - String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk) - String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn) - 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,**/target/failsafe-reports/*.xml', allowEmptyResults: true - } - } - } -} - -Map runITsTasks = [:] -for (String os in runITsOses) { - for (def jdk in runITsJdks) { - String osLabel = jenkinsEnv.labelForOS(os); - String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}") - String mvnName = jenkinsEnv.mvnFromVersion(os, "${runITsMvn}") - echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName}" - - String stageId = "${os}-jdk${jdk}" - String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk}" - runITsTasks[stageId] = { - node(jenkinsEnv.nodeSelection(osLabel)) { - stage("${stageLabel}") { - echo "NODE_NAME = ${env.NODE_NAME}" - // on Windows, need a short path or we hit 256 character limit for paths - // using EXECUTOR_NUMBER guarantees that concurrent builds on same agent - // will not trample each other plus workaround for JENKINS-52657 - dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") { - def WORK_DIR=pwd() - try { - dir ('maven') { - checkout scm - withEnv(["JAVA_HOME=${ tool "$jdkName" }", - "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin", - "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) { - sh "mvn clean install -B -U -e -DskipTests -V -PversionlessMavenDist -Dmaven.repo.local=${WORK_DIR}/.repository" - } - } - dir ('its') { - def ITS_BRANCH = env.CHANGE_BRANCH != null ? env.CHANGE_BRANCH : env.BRANCH_NAME; - try { - echo "Checkout ITs from branch: ${ITS_BRANCH}" - checkout([$class: 'GitSCM', - branches: [[name: ITS_BRANCH]], - extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]], - userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]]) - } catch (Throwable e) { - echo "Failure checkout ITs branch: ${ITS_BRANCH} - fallback master branch" - 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']]]) - } - - try { - withEnv(["JAVA_HOME=${ tool "$jdkName" }", - "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin", - "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) { - String cmd = "${runITscommand} -Dmaven.repo.local=$WORK_DIR/.repository -DmavenDistro=$WORK_DIR/maven/apache-maven/target/apache-maven-bin.zip -Dmaven.test.failure.ignore" - - if (isUnix()) { - sh 'df -hT' - sh "${cmd}" - } else { - bat 'wmic logicaldisk get size,freespace,caption' - bat "${cmd}" - } - } - } finally { - // in ITs test we need only reports from test itself - // test projects can contain reports with tested failed builds - junit testResults: '**/core-it-suite/target/surefire-reports/*.xml,**/core-it-support/**/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']) - } - } - } finally { - deleteDir() // clean up after ourselves to reduce disk space - } - } - } - } - } - } -} - -// run the parallel ITs -parallel(runITsTasks) - -// JENKINS-34376 seems to make it hard to detect the aborted builds -} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { - echo "[FAILURE-002] FlowInterruptedException ${e}" - // this ambiguous condition means a user probably aborted - if (e.causes.size() == 0) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e -} catch (hudson.AbortException e) { - echo "[FAILURE-003] AbortException ${e}" - // this ambiguous condition means during a shell step, user probably aborted - if (e.getMessage().contains('script returned exit code 143')) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e -} catch (InterruptedException e) { - echo "[FAILURE-004] ${e}" - currentBuild.result = "ABORTED" - throw e -} catch (Throwable e) { - echo "[FAILURE-001] ${e}" - currentBuild.result = "FAILURE" - throw e -} finally { - // notify completion - stage("Notifications") { - jenkinsNotify() - } -} - -def archiveDirs(stageId, archives) { - archives.each { archivePrefix, pathToContent -> - if (fileExists(pathToContent)) { - zip(zipFile: "${archivePrefix}-${stageId}.zip", dir: pathToContent, archive: true) - } - } -} diff --git a/disabled-Jenkinsfile.its b/disabled-Jenkinsfile.its deleted file mode 100644 index d52c179fb9..0000000000 --- a/disabled-Jenkinsfile.its +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -pipeline { - agent { node { label 'ubuntu' } } - options { - durabilityHint('PERFORMANCE_OPTIMIZED') - buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '5')) - timeout(time: 180, unit: 'MINUTES') - } - parameters { - string( defaultValue: 'master', description: 'Core Its branch (default master)', - name: 'ITS_BRANCH' ) - } - stages { - stage("Build Maven Core") { - steps { - withEnv(["JAVA_HOME=${ tool "JDK 1.8 (latest)" }", "PATH+MAVEN=${tool 'Maven 3.6.3'}/bin:${env.JAVA_HOME}/bin"]) { - sh "mvn -Drat.skip=true -T2 -B -V install -PversionlessMavenDist -Dmaven.repo.local=${env.WORKSPACE}/repo" - } - } - } - stage( "Run Maven Integration Testing" ) { - steps { - git url: "https://github.com/apache/maven-integration-testing.git", branch: "${ITS_BRANCH}" - sh "ls -lrt ${env.WORKSPACE}/apache-maven/target/" - withEnv(["JAVA_HOME=${ tool "JDK 1.8 (latest)" }", "PATH+MAVEN=${tool 'Maven 3.6.3'}/bin:${env.JAVA_HOME}/bin"]) { - sh "mvn clean install -V -B -Prun-its,embedded -Dmaven.test.failure.ignore -Dmaven.repo.local=${env.WORKSPACE}/repo -DmavenDistro=${env.WORKSPACE}/apache-maven/target/apache-maven-bin.zip" - } - } - } - } - post { - always { - junit testResults: 'core-it-suite/target/surefire-reports/*.xml', allowEmptyResults: true - script{ - currentBuild.description = "Build with Core Its branch:$ITS_BRANCH" - } - cleanWs() - } - } -} diff --git a/disabled-Jenkinsfile.s390x b/disabled-Jenkinsfile.s390x deleted file mode 100644 index ef01369fa6..0000000000 --- a/disabled-Jenkinsfile.s390x +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'5':'1'))]) - -def buildOs = 'linux' -def buildJdk = '17' -def buildMvn = '3.8.x' -def runITsOses = ['linux'] -def runITsJdks = ['17'] -def runITsMvn = '3.8.x' -def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true -def tests - -try { - -def osNode = jenkinsEnv.labelForOS(buildOs) -node('s390x') { - dir('build') { - stage('Checkout') { - checkout scm - } - - def WORK_DIR=pwd() - def MAVEN_GOAL='verify' - - stage('Build / Unit Test') { - String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk) - String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn) - 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,**/target/failsafe-reports/*.xml', allowEmptyResults: true - } - dir ('apache-maven/target') { - stash includes: 'apache-maven-bin.zip', name: 'maven-dist-s390x' - } - } - } -} - -Map runITsTasks = [:] -for (String os in runITsOses) { - for (def jdk in runITsJdks) { - String osLabel = jenkinsEnv.labelForOS(os); - String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}") - String mvnName = jenkinsEnv.mvnFromVersion(os, "${runITsMvn}") - echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName} Arch: s390x" - - String stageId = "${os}-jdk${jdk}-s390x" - String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk} on s390x" - runITsTasks[stageId] = { - node('s390x') { - stage("${stageLabel}") { - echo "NODE_NAME = ${env.NODE_NAME}" - // on Windows, need a short path or we hit 256 character limit for paths - // using EXECUTOR_NUMBER guarantees that concurrent builds on same agent - // will not trample each other plus workaround for JENKINS-52657 - dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") { - def WORK_DIR=pwd() - def ITS_BRANCH = env.CHANGE_BRANCH != null ? env.CHANGE_BRANCH : env.BRANCH_NAME; - try { - echo "Checkout ITs from branch: ${ITS_BRANCH}" - checkout([$class: 'GitSCM', - branches: [[name: ITS_BRANCH]], - extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]], - userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]]) - } catch (Throwable e) { - echo "Failure checkout ITs branch: ${ITS_BRANCH} - fallback master branch" - 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/dists $WORK_DIR/it-local-repo" - } else { - bat "if exist it-local-repo rmdir /s /q it-local-repo" - bat "if exist dists rmdir /s /q dists" - } - dir('dists') { - unstash 'maven-dist-s390x' - } - try { - withEnv(["JAVA_HOME=${ tool "$jdkName" }", - "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin", - "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) { - String cmd = "${runITscommand} -Dmaven.repo.local=$WORK_DIR/it-local-repo -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore" - - if (isUnix()) { - sh 'df -hT' - sh "${cmd}" - } else { - bat 'wmic logicaldisk get size,freespace,caption' - bat "${cmd}" - } - } - } finally { - // in ITs test we need only reports from test itself - // test projects can contain reports with tested failed builds - junit testResults: '**/core-it-suite/target/surefire-reports/*.xml,**/core-it-support/**/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 - } - } - } - } - } - } -} - -// run the parallel ITs -parallel(runITsTasks) - -// JENKINS-34376 seems to make it hard to detect the aborted builds -} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { - echo "[FAILURE-002] FlowInterruptedException ${e}" - // this ambiguous condition means a user probably aborted - if (e.causes.size() == 0) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e -} catch (hudson.AbortException e) { - echo "[FAILURE-003] AbortException ${e}" - // this ambiguous condition means during a shell step, user probably aborted - if (e.getMessage().contains('script returned exit code 143')) { - currentBuild.result = "ABORTED" - } else { - currentBuild.result = "FAILURE" - } - throw e -} catch (InterruptedException e) { - echo "[FAILURE-004] ${e}" - currentBuild.result = "ABORTED" - throw e -} catch (Throwable e) { - echo "[FAILURE-001] ${e}" - currentBuild.result = "FAILURE" - throw e -} - -def archiveDirs(stageId, archives) { - archives.each { archivePrefix, pathToContent -> - if (fileExists(pathToContent)) { - zip(zipFile: "${archivePrefix}-${stageId}.zip", dir: pathToContent, archive: true) - } - } -} diff --git a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java index 053b860d70..744dcfd8c6 100644 --- a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java +++ b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -260,6 +261,17 @@ protected Verifier newVerifier(String basedir, boolean debug) throws Verificatio protected Verifier newVerifier(String basedir, String settings, boolean debug) throws VerificationException { Verifier verifier = new Verifier(basedir); + // try to get jacoco arg from command line if any then use it to start IT to populate jacoco data + // we use a different file than the main one + ProcessHandle.current() + .info() + .arguments() + .flatMap(strings -> Arrays.stream(strings) + .filter(s -> s.contains("-javaagent:") && s.contains("org.jacoco.agent")) + .findFirst()) + .map(s -> s.replace("jacoco.exec", "jacoco-its.exec")) + .ifPresent(verifier::addJvmArgument); + verifier.setAutoclean(false); if (settings != null) { diff --git a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java index 7ec9acdaab..1c9406fcc1 100644 --- a/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java +++ b/its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java @@ -102,6 +102,8 @@ public class Verifier { private final List<String> cliArguments = new ArrayList<>(); + private final List<String> jvmArguments = new ArrayList<>(); + private Path userHomeDirectory; // the user home private String executable = ExecutorRequest.MVN; @@ -213,6 +215,7 @@ public void execute() throws VerificationException { .command(executable) .cwd(basedir) .userHomeDirectory(userHomeDirectory) + .jvmArguments(jvmArguments) .arguments(args); if (!systemProperties.isEmpty()) { builder.jvmSystemProperties(new HashMap(systemProperties)); @@ -264,6 +267,15 @@ public void addCliArgument(String cliArgument) { cliArguments.add(cliArgument); } + /** + * Add a jvm argument, each argument must be set separately one by one. + * + * @param jvmArgument an argument to add + */ + public void addJvmArgument(String jvmArgument) { + jvmArguments.add(jvmArgument); + } + /** * Add a command line arguments, each argument must be set separately one by one. * <p> diff --git a/its/pom.xml b/its/pom.xml index d287614b72..8a217784fd 100644 --- a/its/pom.xml +++ b/its/pom.xml @@ -23,7 +23,7 @@ under the License. <parent> <groupId>org.apache.maven</groupId> <artifactId>maven</artifactId> - <version>4.0.0-rc-3-SNAPSHOT</version> + <version>4.0.0-rc-4-SNAPSHOT</version> </parent> <groupId>org.apache.maven.its</groupId> @@ -73,7 +73,7 @@ under the License. <!-- <maven.compiler.source>8</maven.compiler.source>--> <!-- <maven.compiler.target>8</maven.compiler.target>--> - <maven-version>4.0.0-rc-3-SNAPSHOT</maven-version> + <maven-version>4.0.0-rc-4-SNAPSHOT</maven-version> <maven-plugin-tools-version>3.15.1</maven-plugin-tools-version> </properties> diff --git a/pom.xml b/pom.xml index 956bc27b75..dc4f095689 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,7 @@ under the License. <wagonVersion>3.5.3</wagonVersion> <woodstoxVersion>7.1.0</woodstoxVersion> <xmlunitVersion>2.10.0</xmlunitVersion> + <jacocoArgLine /> </properties> <!--bootstrap-start-comment--> @@ -701,7 +702,7 @@ under the License. <version>3.5.2</version> <configuration> <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" /> - <argLine>-Xmx256m</argLine> + <argLine>-Xmx256m @{jacocoArgLine}</argLine> </configuration> </plugin> <plugin> @@ -755,6 +756,13 @@ under the License.</licenseText> <artifactId>build-helper-maven-plugin</artifactId> <version>3.6.0</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <deployAtEnd>true</deployAtEnd> + </configuration> + </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> @@ -769,9 +777,29 @@ under the License.</licenseText> <includePom>true</includePom> </configuration> </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.12</version> + <configuration> + <excludes> + <exclude>**/org/apache/maven/it/**</exclude> + <exclude>**/org/apache/maven/its/**</exclude> + <exclude>**/org/apache/maven/coreit/**</exclude> + <exclude>**/org/apache/maven/plugin/coreit/**</exclude> + <exclude>**/org/apache/maven/wagon/providers/coreit/**</exclude> + <exclude>**/org/apache/maven/coreits/**</exclude> + </excludes> + </configuration> + </plugin> </plugins> </pluginManagement> <plugins> + <plugin> + <groupId>io.github.olamy.maven.plugins</groupId> + <artifactId>jacoco-aggregator-maven-plugin</artifactId> + <version>1.0.0</version> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-doap-plugin</artifactId> @@ -795,6 +823,7 @@ under the License.</licenseText> <inherited>false</inherited> <configuration> <excludes> + <exclude>Jenkinsfile</exclude> <exclude>**/.gitattributes</exclude> <exclude>src/test/resources*/**</exclude> <exclude>src/test/projects/**</exclude> @@ -1067,5 +1096,64 @@ under the License.</licenseText> <module>its</module> </modules> </profile> + <profile> + <id>ci</id> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <reportsDirectory>${project.build.directory}/test-results-surefire</reportsDirectory> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + </profile> + <profile> + <id>jacoco</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>-Xmx1G @{jacocoArgLine}</argLine> + <reportsDirectory>${project.build.directory}/test-results-surefire</reportsDirectory> + </configuration> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>jacoco-initialize</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <phase>initialize</phase> + <configuration> + <propertyName>jacocoArgLine</propertyName> + </configuration> + </execution> + <execution> + <id>jacoco-site</id> + <goals> + <goal>report</goal> + </goals> + <phase>package</phase> + <configuration> + <includes> + <include>**/org/apache/maven/**</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> </project>