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

sjaranowski 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 6f05920c56 Improvements in ITs - executing by mvn verify
6f05920c56 is described below

commit 6f05920c569d053f790cd25e01153b595691b3c4
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Wed Jul 23 20:28:24 2025 +0200

    Improvements in ITs - executing by mvn verify
    
    Integration tests should be isolated from local repository,
    install should not be required for executing tests.
    
    Fix to allow a build project by:
      mvn verify -P run-its
    
    Use failsafe plugin for executing test in integration phase
    and invoker for preparing local repository for tests
    
    # Conflicts:
    #       its/core-it-suite/pom.xml
---
 .github/workflows/maven.yml                        |   6 +-
 its/core-it-suite/pom.xml                          | 107 +++++++++++++++++----
 .../maven/it/MavenITmng5669ReadPomsOnce.java       |   2 +-
 its/pom.xml                                        |   9 --
 pom.xml                                            |   8 ++
 5 files changed, 102 insertions(+), 30 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 1156abe3cc..f55517fa97 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -167,7 +167,7 @@ jobs:
 
       - name: Upload test artifacts
         uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 
# v4
-        if: failure()
+        if: failure() || cancelled()
         with:
           name: ${{ github.run_number }}-full-build-artifact-${{ runner.os 
}}-${{ matrix.java }}
           path: '**/target/surefire-reports/*'
@@ -242,11 +242,11 @@ jobs:
 
       - name: Build Maven and ITs and run them
         shell: bash
-        run: mvn install -e -B -V -Prun-its,mimir
+        run: mvn verify -e -B -V -Prun-its,mimir
 
       - name: Upload test artifacts
         uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 
# v4
-        if: failure()
+        if: failure() || cancelled()
         with:
           name: ${{ github.run_number }}-integration-test-artifact-${{ 
runner.os }}-${{ matrix.java }}
           path: ./its/core-it-suite/target/test-classes/
diff --git a/its/core-it-suite/pom.xml b/its/core-it-suite/pom.xml
index f50843166d..ca72766e6f 100644
--- a/its/core-it-suite/pom.xml
+++ b/its/core-it-suite/pom.xml
@@ -34,13 +34,13 @@ under the License.
   <!--
   By default, the project just packages the tests in an artifact. To actually 
run them, activate the profile "run-its":
 
-    mvn clean test -Prun-its
+    mvn clean verify -Prun-its
 
   This will test the Maven distribution generated by the current build 
(apache-maven/target/apache-maven-xxx.zip).
 
   If you would like to test the Maven version running the build instead, use 
the "maven-from-build" profile:
 
-    mvn clean test -Prun-its,maven-from-build
+    mvn clean verify -Prun-its,maven-from-build
 
   The "maven-from-build" profile restores the old default behavior where the 
integration tests run against the
   Maven installation that is executing the build (i.e., the value of 
${maven.home}). This is useful when you want
@@ -49,16 +49,16 @@ under the License.
   You can also specify the path of a specific Maven distribution to test using 
the "mavenHome" property (this
   automatically activates the "maven-from-build" profile):
 
-    mvn clean test -Prun-its -DmavenHome=<maven-under-test>
+    mvn clean verify -Prun-its -DmavenHome=<maven-under-test>
 
   Alternatively, you can specify the version of a previously 
installed/deployed Maven distribution which will be
   downloaded, unpacked and tested:
 
-    mvn clean test -Prun-its -DmavenVersion=2.2.1
+    mvn clean verify -Prun-its -DmavenVersion=2.2.1
 
   It's also possible to point the ITs at an already downloaded Maven 
distribution:
 
-    mvn clean test -Prun-its -DmavenDistro=<path-to-bin-archive>
+    mvn clean verify -Prun-its -DmavenDistro=<path-to-bin-archive>
 
   To run all the ITs using forked Maven, additionally activate the profile 
"forked".
 
@@ -94,6 +94,7 @@ under the License.
     <core-it-support-version>2.1-SNAPSHOT</core-it-support-version>
 
     <its.forkCount>0.75C</its.forkCount>
+    <its.test />
   </properties>
 
   <dependencies>
@@ -261,6 +262,12 @@ under the License.
       <artifactId>maven-it-plugin-class-loader</artifactId>
       <version>${core-it-support-version}</version>
     </dependency>
+    <dependency>
+      <!-- dep-c is an optional dependency of maven-it-plugin-class-loader, so 
it should not be transitively included -->
+      <groupId>org.apache.maven.its.plugins.class-loader</groupId>
+      <artifactId>dep-c</artifactId>
+      <version>${core-it-support-version}</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.its.plugins</groupId>
       <artifactId>maven-it-plugin-configuration</artifactId>
@@ -353,7 +360,6 @@ under the License.
       <artifactId>maven-it-plugin-plexus-lifecycle</artifactId>
       <version>${core-it-support-version}</version>
     </dependency>
-
   </dependencies>
 
   <build>
@@ -398,17 +404,42 @@ under the License.
         </plugin>
       </plugins>
     </pluginManagement>
+
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <configuration>
+          <skipInstallation>true</skipInstallation>
+          
<localRepositoryPath>${preparedUserHome}/.m2/repository</localRepositoryPath>
+        </configuration>
+        <executions>
+          <execution>
+            <id>install</id>
+            <goals>
+              <goal>install</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <configuration>
+          <test>${its.test}</test>
           <includes>
             <include>**/MavenIT*.java</include>
           </includes>
           <!-- test annotated by @Tag("disabled") will be skipped from 
executions -->
           <excludedGroups>disabled</excludedGroups>
-          <skip>true</skip>
+          <skipTests>true</skipTests>
           <forkCount>${its.forkCount}</forkCount>
           <reuseForks>true</reuseForks>
           <!-- NOTE: Maven plugins have access to the system class path, keep 
it clean -->
@@ -419,7 +450,6 @@ under the License.
             
<maven.test.repo.outer>${settings.localRepository}</maven.test.repo.outer>
             
<maven.test.repo.local>${preparedUserHome}/.m2/repository</maven.test.repo.local>
             
<maven.test.tmpdir>${project.build.testOutputDirectory}</maven.test.tmpdir>
-            <maven.version>${maven.version}</maven.version>
             <maven.home>${preparedMavenHome}</maven.home>
             
<maven.it.global-settings.dir>${project.build.testOutputDirectory}</maven.it.global-settings.dir>
           </systemPropertyVariables>
@@ -428,6 +458,14 @@ under the License.
             
<excludedEnvironmentVariable>MAVEN_OPTS</excludedEnvironmentVariable>
           </excludedEnvironmentVariables>
         </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -529,6 +567,13 @@ under the License.
           <version>${project.version}</version>
           <classifier>bin</classifier>
           <type>zip</type>
+          <exclusions>
+            <!-- dependency only on Maven distribution -->
+            <exclusion>
+              <groupId>*</groupId>
+              <artifactId>*</artifactId>
+            </exclusion>
+          </exclusions>
         </dependency>
         <!-- not really used but will force download in the local repo used -->
         <dependency>
@@ -552,9 +597,16 @@ under the License.
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-surefire-plugin</artifactId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <configuration>
+              <skipInstallation>false</skipInstallation>
+            </configuration>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
             <configuration>
-              <skip>false</skip>
+              <skipTests>false</skipTests>
               <redirectTestOutputToFile>false</redirectTestOutputToFile>
             </configuration>
           </plugin>
@@ -571,7 +623,7 @@ under the License.
       <build>
         <plugins>
           <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
+            <artifactId>maven-failsafe-plugin</artifactId>
             <configuration>
               <systemPropertyVariables>
                 <!-- Pass this through to the tests (if set!) to have them
@@ -588,9 +640,16 @@ under the License.
       <build>
         <plugins>
           <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
             <configuration>
-              <skip>false</skip>
+              <skipInstallation>false</skipInstallation>
+            </configuration>
+          </plugin>
+          <plugin>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <configuration>
+              <skipTests>false</skipTests>
               <systemPropertyVariables>
                 <verifier.forkMode>forked</verifier.forkMode>
               </systemPropertyVariables>
@@ -612,9 +671,16 @@ under the License.
       <build>
         <plugins>
           <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <configuration>
+              <skipInstallation>false</skipInstallation>
+            </configuration>
+          </plugin>
+          <plugin>
+            <artifactId>maven-failsafe-plugin</artifactId>
             <configuration>
-              <skip>false</skip>
+              <skipTests>false</skipTests>
             </configuration>
           </plugin>
           <plugin>
@@ -686,9 +752,16 @@ under the License.
       <build>
         <plugins>
           <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <configuration>
+              <skipInstallation>false</skipInstallation>
+            </configuration>
+          </plugin>
+          <plugin>
+            <artifactId>maven-failsafe-plugin</artifactId>
             <configuration>
-              <skip>false</skip>
+              <skipTests>false</skipTests>
             </configuration>
           </plugin>
           <plugin>
diff --git 
a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
 
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
index e020d3ff8f..b5bee035c8 100644
--- 
a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
+++ 
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
@@ -50,7 +50,7 @@ public void testWithoutBuildConsumer() throws Exception {
         Verifier verifier = newVerifier(testDir.getAbsolutePath(), false);
         Map<String, String> filterProperties = Collections.singletonMap(
                 "${javaAgentJar}",
-                verifier.getSupportArtifactPath("org.apache.maven.its", 
"core-it-javaagent", "2.1-SNAPSHOT", "jar"));
+                verifier.getArtifactPath("org.apache.maven.its", 
"core-it-javaagent", "2.1-SNAPSHOT", "jar"));
         verifier.filterFile(".mvn/jvm.config", ".mvn/jvm.config", null, 
filterProperties);
 
         verifier.setForkJvm(true); // pick up agent
diff --git a/its/pom.xml b/its/pom.xml
index d98b835dd0..e557d01e73 100644
--- a/its/pom.xml
+++ b/its/pom.xml
@@ -283,15 +283,6 @@ under the License.
   <build>
     <pluginManagement>
       <plugins>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <configuration>
-            <environmentVariables>
-              <JENKINS_MAVEN_AGENT_DISABLED>true</JENKINS_MAVEN_AGENT_DISABLED>
-            </environmentVariables>
-          </configuration>
-        </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-javadoc-plugin</artifactId>
diff --git a/pom.xml b/pom.xml
index 39e5e70bdd..369fb92474 100644
--- a/pom.xml
+++ b/pom.xml
@@ -700,6 +700,14 @@ under the License.
             <argLine>-Xmx256m @{jacocoArgLine}</argLine>
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <configuration>
+            <forkNode 
implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"
 />
+            <argLine>-Xmx256m @{jacocoArgLine}</argLine>
+          </configuration>
+        </plugin>
         <!-- enforce backwards compatibility -->
         <plugin>
           <groupId>com.github.siom79.japicmp</groupId>

Reply via email to