From c1507ebb959a95f7d4cff6eeee6c7366f925a557 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:21:08 +0100 Subject: [PATCH 01/10] Update jacoco-maven-plugin to work with Java versions --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a047a0b..85600d4 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.12 default-prepare-agent From cd6ddd00308544a2978dfccf56ba3348e74b06d3 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:21:35 +0100 Subject: [PATCH 02/10] Change group and artifact ID --- README.md | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d6cd095..b7fd73e 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ Add it to your `pom.xml` within the `` section as follows and specify the - de.philippkatz.maven.plugins - test-parser-plugin + de.philippkatz + test-parser-maven-plugin 3.1.0 ${project.build.directory}/testflow-reports diff --git a/pom.xml b/pom.xml index 85600d4..249d714 100644 --- a/pom.xml +++ b/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - de.philippkatz.maven.plugins - test-parser-plugin + de.philippkatz + test-parser-maven-plugin maven-plugin 3.1.1-SNAPSHOT From b1d122152a3907a504c2baf07fc973cbba92d596 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:21:44 +0100 Subject: [PATCH 03/10] Update year --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7fd73e..efecf87 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ opening a new [issue][2]. - - - -Copyright (c) 2017 – 2020, Philipp Katz +Copyright (c) 2017 – 2025, Philipp Katz [1]: http://maven.40175.n5.nabble.com/How-to-parse-JUnit-report-xml-that-causes-build-to-pass-fail-td5433750.html From 6dcaf17e607244121597dba3fe66d45c484255e8 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:24:26 +0100 Subject: [PATCH 04/10] Fix publishing to Maven MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * OSSRH was replaced with “Central” - see https://central.sonatype.org/pages/ossrh-eol/#process-to-migrate --- .gitignore | 1 + pom.xml | 29 ++++++++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 520e0b1..8ad8df2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target/ .settings/ .classpath .project +settings.xml diff --git a/pom.xml b/pom.xml index 249d714..3d61086 100644 --- a/pom.xml +++ b/pom.xml @@ -32,17 +32,6 @@ http://github.com/qqilihq/maven-test-parser-plugin/tree/master - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - UTF-8 @@ -74,14 +63,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 + org.sonatype.central + central-publishing-maven-plugin + 0.9.0 true - ossrh - https://oss.sonatype.org/ - true + central + true + published @@ -141,7 +130,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.4 sign-artifacts @@ -155,7 +144,9 @@ --pinentry-mode loopback - + ${gpg.keyname} + ${gpg.keyname} + From dc14edaabaab1fa0631851074d80030977bf0ba9 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:24:49 +0100 Subject: [PATCH 05/10] Add changelog --- changelog.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..a94c5df --- /dev/null +++ b/changelog.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## unreleased + +### Changed +* Change Maven group ID to `de.philippkatz` and artifact ID to `test-parser-maven-plugin`. + +### Fixed +* Update `jacoco-maven-plugin` to `0.8.12` for Java 17 compatibility. + +## 3.1.0 – 2018-08-23 From 42b7d05810c5c1b24e4445fcc2e59f4782c82d49 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:30:46 +0100 Subject: [PATCH 06/10] Update pom.xml based on dependency-resolver-plugin --- pom.xml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 3d61086..4622162 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,7 @@ + 11 UTF-8 @@ -40,7 +41,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.13.1 true @@ -54,14 +55,6 @@ - - maven-compiler-plugin - 3.3 - - 1.7 - 1.7 - - org.sonatype.central central-publishing-maven-plugin @@ -104,7 +97,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.1 attach-sources @@ -117,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.7.0 attach-javadocs From 952098bedc50b2fc1774ddb33853172c77f11310 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:42:41 +0100 Subject: [PATCH 07/10] Push SNAPSHOT on build - TODO readd condition --- .github/workflows/main.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19f3a63..1b93f6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,23 +19,26 @@ jobs: - uses: actions/checkout@v2 # https://github.com/marketplace/actions/setup-java-jdk#publishing-using-apache-maven - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: - java-version: '8' - server-id: ossrh - server-username: OSSRH_USERNAME - server-password: OSSRH_PASSWORD + java-version: '17' + distribution: zulu + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_PASSWORD gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} gpg-passphrase: GPG_PASSPHRASE - - name: Build (and publish to Sonatype OSSRH when on master) + - name: Build (and publish to Maven Central when on master) run: | + # MAVEN_TASK="verify" # only use -P release when on master branch - if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_PROFILE="deploy -P release"; fi - mvn -V -B clean install $MAVEN_PROFILE + # if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_TASK="deploy -P release"; fi + # mvn -V -B $MAVEN_TASK + mvn -V -B deploy -P release env: - OSSRH_USERNAME: qqilihq - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - uses: codecov/codecov-action@v1 From 81dea35a70c93bd9a0363194c8bdc2a44f51ca4b Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:51:33 +0100 Subject: [PATCH 08/10] Trim trailing space --- README.md | 6 +++--- .../maven/plugins/TestParserMojo.java | 18 +++++++++--------- .../maven/plugins/TestParserMojoTest.java | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index efecf87..8452ffc 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ About This [Maven][3] plugin solves the following issue which I described in [this][2] Stack Overflow question: > I'm running a Maven build workflow which involves running a 3rd party tool for integration testing, which produces multiple XML files in JUnit style (however, those files are **not** created by JUnit and I have no control over the testing procedure). -> +> > Is there a Maven plugin, which allows me to parse those files? Especially, I would like the build to fail, in case those XML files list a failure. -> +> > My exact problem has been described [here][1] some years ago, and the proposed solutions were: -> +> > 1. *"Write your own plugin to call your external test and report failures, either by parsing the xml or some other approach"* -- potential solution, however I hope that some years later maybe there is something ready-to-use? > 2. *"Adjust your external test tool so it returns "false" (1) when it has a diff --git a/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java b/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java index de4d0fb..325a52f 100644 --- a/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java +++ b/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java @@ -17,12 +17,12 @@ /** * Goal to parse JUnit-style XML results. - * + * * @author Philipp Katz */ @Mojo(name = "testparser", requiresProject = false) public class TestParserMojo extends AbstractMojo { - + private static final String SKIPPED = "skipped"; /** Directory which contains the reports. */ @@ -71,8 +71,8 @@ public void execute() throws MojoExecutionException { } Map summary = parser.getSummary(parsedReports); getLog().info(String.format("Tests run: %s, Failures: %s, Errors: %s, Skipped: %s", - summary.get("totalTests"), - summary.get("totalFailures"), + summary.get("totalTests"), + summary.get("totalFailures"), summary.get("totalErrors"), summary.get("totalSkipped"))); if (!errors.isEmpty() && !failures.isEmpty()) { @@ -88,10 +88,10 @@ public void execute() throws MojoExecutionException { /** * Walks over a tree of directories and recursively adds all these directories to a list of File objects. - * + * * @param rootDirectory The root directory from where to start the search for sub directories. * @return A List of the directory provided as root and all its sub directories. - * @throws MojoExecutionException + * @throws MojoExecutionException */ static List collectReportDirectoriesRecursively(final File rootDirectory) throws MojoExecutionException { if (rootDirectory == null) { @@ -103,16 +103,16 @@ static List collectReportDirectoriesRecursively(final File rootDirectory) if (!rootDirectory.isDirectory()) { throw new MojoExecutionException("Directory " + rootDirectory + " is no directory"); } - + List ret = new ArrayList<>(); ret.add(rootDirectory); - + for (File child : rootDirectory.listFiles()) { if (child.isDirectory()) { ret.addAll(collectReportDirectoriesRecursively(child)); } } - + return ret; } diff --git a/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java b/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java index d8e04f0..6a4aaf6 100644 --- a/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java +++ b/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java @@ -47,7 +47,7 @@ public void testTestParserMojoWithoutFailures() { assertEquals(2, logResult.split("\n").length); assertTrue(logResult.contains("Tests run: 9, Failures: 0, Errors: 0, Skipped: 0")); } - + @Test public void testTestParserMojoWithSkipsShouldNotBeTreatedAsFailures() { TestParserMojo mojo = new TestParserMojo(); @@ -66,7 +66,7 @@ public void testTestParserMojoWithSkipsShouldNotBeTreatedAsFailures() { /** * Tests whether recursive collection of result folders works correctly. - * + * * @throws MojoExecutionException * Fails the test if anything unexpected goes wrong. */ From c9ff4eab04404af7ca9568aa88942797606d5c41 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:55:43 +0100 Subject: [PATCH 09/10] Fix codecov --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b93f6e..86ccaca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,9 +41,11 @@ jobs: CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v5 with: file: ./target/site/jacoco/jacoco.xml fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true # TODO parse surefire reports From 47ad0bfb18c349206699eed409824c2bc7ba6d72 Mon Sep 17 00:00:00 2001 From: Philipp Katz Date: Sat, 22 Nov 2025 13:59:27 +0100 Subject: [PATCH 10/10] Re-add conditional deploy --- .github/workflows/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86ccaca..3b4dbf9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,11 +31,10 @@ jobs: - name: Build (and publish to Maven Central when on master) run: | - # MAVEN_TASK="verify" + MAVEN_TASK="verify" # only use -P release when on master branch - # if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_TASK="deploy -P release"; fi - # mvn -V -B $MAVEN_TASK - mvn -V -B deploy -P release + if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_TASK="deploy -P release"; fi + mvn -V -B $MAVEN_TASK env: CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}