Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ 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
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-beta-4"

- 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions its/core-it-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,28 @@ under the License.
</plugins>
</build>
</profile>
<profile>
<id>maven-repo-local-tail</id>
<activation>
<property>
<name>maven.repo.local.tail</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- Pass this through to the tests (if set!) to have them
pick the right repository -->
<maven.repo.local.tail>${maven.repo.local.tail}</maven.repo.local.tail>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>maven-repo-local-layout</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void testitModel() throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@

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 {
Expand Down Expand Up @@ -95,4 +101,8 @@ public static void verifyTextInLog(List<String> lines, String text) throws Verif
public static long textOccurencesInLog(List<String> lines, String text) {
return lines.stream().filter(line -> stripAnsi(line).contains(text)).count();
}

public void execute() throws VerificationException {
super.execute();
}
}