diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 15de9cda99..6d05d23547 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -45,9 +45,10 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.m2/repository/cached
- key: maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: maven-
- enableCrossOsArchive: true
+ key: maven-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ maven-${{ runner.os }}-initial-
+ maven-${{ runner.os }}-
- name: Set up Maven
shell: bash
@@ -55,7 +56,7 @@ jobs:
- name: Build Maven distributions
shell: bash
- run: ./mvnw verify -e -B -V -DdistributionFileName=apache-maven
+ run: ./mvnw verify -e -B -V -DdistributionFileName=apache-maven -Dmaven.repo.local=$HOME/.m2/repository/cached
- name: List contents of target directory
shell: bash
@@ -123,9 +124,18 @@ jobs:
echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
echo "$PWD/maven-local/bin" >> $GITHUB_PATH
+ - name: Cache Maven packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository/cached
+ key: maven-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ maven-${{ runner.os }}-full-
+ maven-${{ runner.os }}-
+
- name: Build site with downloaded Maven
shell: bash
- run: mvn verify site -e -B -V -DdistributionFileName=apache-maven -Preporting
+ run: mvn verify site -e -B -V -Preporting -Dmaven.repo.local=$HOME/.m2/repository/cached
integration-tests:
needs: initial-build
@@ -174,9 +184,18 @@ jobs:
echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
echo "$PWD/maven-local/bin" >> $GITHUB_PATH
+ - name: Cache Maven packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository/cached
+ key: maven-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ maven-${{ runner.os }}-its
+ maven-${{ runner.os }}-
+
- name: Run integration tests
shell: bash
- run: mvn install -e -B -V -Prun-its,embedded
+ run: mvn install -e -B -V -Prun-its,embedded -Dmaven.repo.local=$HOME/.m2/repository/local -Dmaven.repo.local.tail=$HOME/.m2/repository/cached
- name: Upload test artifacts
uses: actions/upload-artifact@v4
diff --git a/its/core-it-suite/pom.xml b/its/core-it-suite/pom.xml
index c3d1ec5e25..c0a642f490 100644
--- a/its/core-it-suite/pom.xml
+++ b/its/core-it-suite/pom.xml
@@ -633,6 +633,28 @@ under the License.
+
+ maven-repo-local-tail
+
+
+ maven.repo.local.tail
+
+
+
+
+
+ maven-surefire-plugin
+
+
+
+ ${maven.repo.local.tail}
+
+
+
+
+
+
maven-repo-local-layout
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java
index 9f66ae7886..3aea83f526 100644
--- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8181CentralRepoTest.java
@@ -48,6 +48,7 @@ public class MavenITmng8181CentralRepoTest extends AbstractMavenIntegrationTestC
verifier.addCliArgument("--install-settings=install-settings.xml");
verifier.addCliArgument("--settings=settings.xml");
verifier.addCliArgument("-Dmaven.repo.local=" + testDir.toPath().resolve("target/local-repo"));
+ verifier.addCliArgument("-Dmaven.repo.local.tail=target/null");
verifier.addCliArgument("-Dmaven.repo.central=http://repo1.maven.org/");
verifier.addCliArgument("validate");
assertThrows(VerificationException.class, verifier::execute);
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 55e447e1fc..b7b81d3bb9 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
@@ -29,11 +29,17 @@ import org.apache.maven.shared.verifier.VerificationException;
public class Verifier extends org.apache.maven.shared.verifier.Verifier {
public Verifier(String basedir) throws VerificationException {
- super(basedir);
+ this(basedir, false);
}
public Verifier(String basedir, boolean debug) throws VerificationException {
- super(basedir, debug);
+ super(basedir, null, debug, defaultCliArguments());
+ }
+
+ static String[] defaultCliArguments() {
+ return new String[] {
+ "-e", "--batch-mode", "-Dmaven.repo.local.tail=" + System.getProperty("maven.repo.local.tail")
+ };
}
public String loadLogContent() throws IOException {
@@ -95,4 +101,8 @@ public class Verifier extends org.apache.maven.shared.verifier.Verifier {
public static long textOccurencesInLog(List lines, String text) {
return lines.stream().filter(line -> stripAnsi(line).contains(text)).count();
}
+
+ public void execute() throws VerificationException {
+ super.execute();
+ }
}