From ea51bc752ab18d51ddefbb971256d8abea8f3931 Mon Sep 17 00:00:00 2001 From: Carlos Macasaet Date: Fri, 17 Jun 2022 22:51:44 -0700 Subject: [PATCH 1/2] Support Maven Site Plugin 4.0.x This breaks backward compatibility with `maven-site-plugin:3.4.x` and possibly other old versions as well. A revision bump is recommended. This commit updates the Maven plugin-related dependencies and modifies any code affected by breaking changes. Closes #1037 --- pitest-maven-verification/pom.xml | 11 +++- .../test/resources/pit-site-combined/pom.xml | 2 +- .../resources/pit-site-custom-config/pom.xml | 2 +- .../pit-site-multiple-timestamped/pom.xml | 2 +- .../pit-site-non-timestamped/pom.xml | 2 +- .../resources/pit-site-reportonly/pom.xml | 2 +- .../src/test/resources/pit-site-skip/pom.xml | 2 +- .../resources/pit-site-timestamped/pom.xml | 2 +- pitest-maven/pom.xml | 59 ++++++++++++++----- .../AbstractPitAggregationReportMojo.java | 5 +- .../pitest/maven/report/PitReportMojo.java | 12 ++-- .../maven/report/PitReportMojoTest.java | 4 +- pom.xml | 2 +- 13 files changed, 74 insertions(+), 33 deletions(-) diff --git a/pitest-maven-verification/pom.xml b/pitest-maven-verification/pom.xml index 654c6b30b..4f44874a3 100644 --- a/pitest-maven-verification/pom.xml +++ b/pitest-maven-verification/pom.xml @@ -59,7 +59,7 @@ org.apache.maven maven-artifact - ${maven.version} + 3.8.6 org.apache.maven @@ -107,4 +107,13 @@ test + + + + org.apache.maven + maven-core + 3.8.6 + + + diff --git a/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml index 591656b69..f99c9bd5f 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml index 34d256fda..0a7ab679c 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml index 7e1baa189..4dc457da9 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml index 6922abea7..d24c2cb11 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml index 6507ae48c..048777eb1 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml @@ -20,7 +20,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml index 18d573df9..8114cdaff 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml index f8014f2f0..3a8c3a8f3 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 3.4 + 4.0.0-M1 diff --git a/pitest-maven/pom.xml b/pitest-maven/pom.xml index f272790c0..bd73b98dc 100644 --- a/pitest-maven/pom.xml +++ b/pitest-maven/pom.xml @@ -46,7 +46,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5 + 3.6.4 default-descriptor @@ -82,18 +82,19 @@ org.apache.maven maven-plugin-api - ${maven.version} + 3.8.6 + provided org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.6.4 provided org.apache.maven.reporting maven-reporting-api - ${maven.version} + 4.0.0-M1 @@ -110,18 +111,18 @@ org.codehaus.plexus plexus-utils - 3.3.0 + 3.3.1 org.apache.maven.reporting maven-reporting-impl - 2.0.4.3 - - - org.apache.maven - maven-project - ${maven.version} + 4.0.0-M1 + + backport-util-concurrent + backport-util-concurrent + 3.1 + org.apache.maven.scm maven-scm-api @@ -159,12 +160,14 @@ org.apache.maven maven-artifact - ${maven.version} + 3.8.6 + provided org.apache.maven maven-toolchain ${maven.version} + provided org.slf4j @@ -185,9 +188,21 @@ - org.apache.maven.shared + org.apache.maven.plugin-testing maven-plugin-testing-harness - 1.1 + 3.3.0 + test + + + ch.qos.logback + logback-classic + 1.2.11 + test + + + org.apache.maven + maven-compat + 3.8.6 test @@ -195,5 +210,21 @@ 1.9.4 + 3.0.0-M7 + + + + org.codehaus.plexus + plexus-interpolation + 1.21 + + + org.apache.maven + maven-core + 3.8.6 + provided + + + diff --git a/pitest-maven/src/main/java/org/pitest/maven/report/AbstractPitAggregationReportMojo.java b/pitest-maven/src/main/java/org/pitest/maven/report/AbstractPitAggregationReportMojo.java index 1daa72b7d..bff5b5b36 100644 --- a/pitest-maven/src/main/java/org/pitest/maven/report/AbstractPitAggregationReportMojo.java +++ b/pitest-maven/src/main/java/org/pitest/maven/report/AbstractPitAggregationReportMojo.java @@ -14,6 +14,7 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -61,8 +62,8 @@ protected void executeReport(final Locale locale) } final ReportAggregator reportAggregator = reportAggregationBuilder - .inputCharSet(this.getInputEncoding()) - .outputCharset(this.getOutputEncoding()) + .inputCharSet(Charset.forName(this.getInputEncoding())) + .outputCharset(Charset.forName(this.getOutputEncoding())) .resultOutputStrategy(new DirectoryResultOutputStrategy( getReportsDirectory().getAbsolutePath(), new UndatedReportDirCreationStrategy())) diff --git a/pitest-maven/src/main/java/org/pitest/maven/report/PitReportMojo.java b/pitest-maven/src/main/java/org/pitest/maven/report/PitReportMojo.java index f63860519..e601d7dc0 100644 --- a/pitest-maven/src/main/java/org/pitest/maven/report/PitReportMojo.java +++ b/pitest-maven/src/main/java/org/pitest/maven/report/PitReportMojo.java @@ -185,18 +185,18 @@ public List getSourceDataFormats() { return this.sourceDataFormats; } - public Charset getInputEncoding() { + public String getInputEncoding() { if (inputEncoding != null) { - return Charset.forName(inputEncoding); + return inputEncoding; } - return Charset.defaultCharset(); + return Charset.defaultCharset().name(); } - public Charset getOutputEncoding() { + public String getOutputEncoding() { if (outputEncoding != null) { - return Charset.forName(outputEncoding); + return outputEncoding; } - return Charset.defaultCharset(); + return Charset.defaultCharset().name(); } private ReportGenerationContext buildReportGenerationContext(Locale locale) { diff --git a/pitest-maven/src/test/java/org/pitest/maven/report/PitReportMojoTest.java b/pitest-maven/src/test/java/org/pitest/maven/report/PitReportMojoTest.java index b835f5567..7cd3d6b57 100644 --- a/pitest-maven/src/test/java/org/pitest/maven/report/PitReportMojoTest.java +++ b/pitest-maven/src/test/java/org/pitest/maven/report/PitReportMojoTest.java @@ -14,7 +14,7 @@ */ package org.pitest.maven.report; -import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.sameInstance; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.verify; @@ -93,7 +93,7 @@ public void testGenerateReport() throws Exception { assertThat(actualContext.getReportsDataDirectory(), sameInstance(this.reportsDirectory)); assertThat(actualContext.getSink(), sameInstance(this.sink)); - assertThat(actualContext.getSiteDirectory().getPath(), is("abspath" + assertThat(actualContext.getSiteDirectory().getPath(), endsWith("abspath" + File.separator + "pit-reports")); } diff --git a/pom.xml b/pom.xml index 7c5208075..c0b560426 100644 --- a/pom.xml +++ b/pom.xml @@ -403,7 +403,7 @@ 4.11 2.2.1 1.7.3 - 2.17 + 2.18.1 1.7.12 ${surefire.version} From c40f054fdd4de6a685595ea2a36cd7923cd87a07 Mon Sep 17 00:00:00 2001 From: Carlos Macasaet Date: Tue, 21 Jun 2022 21:56:31 -0700 Subject: [PATCH 2/2] Downgrade maven-reporting to latest non-milestone This downgrades the `maven-reporting-*` libraries to use the latest non-milestone version. In addition, the integration tests are updated to use the latest non-milestone version of `maven-site-plugin`. Note that the surefire dependencies need to remain on a milestone version to avoid missing class errors. Closes #1037 --- .../src/test/resources/pit-site-combined/pom.xml | 2 +- .../src/test/resources/pit-site-custom-config/pom.xml | 2 +- .../src/test/resources/pit-site-multiple-timestamped/pom.xml | 2 +- .../src/test/resources/pit-site-non-timestamped/pom.xml | 2 +- .../src/test/resources/pit-site-reportonly/pom.xml | 2 +- .../src/test/resources/pit-site-skip/pom.xml | 2 +- .../src/test/resources/pit-site-timestamped/pom.xml | 2 +- pitest-maven/pom.xml | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml index f99c9bd5f..40a71c153 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-combined/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml index 0a7ab679c..266344a61 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-custom-config/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml index 4dc457da9..949901224 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-multiple-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml index d24c2cb11..147fef5c2 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-non-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml index 048777eb1..0cbc6b01c 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-reportonly/pom.xml @@ -20,7 +20,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml index 8114cdaff..44ee215a5 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-skip/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml b/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml index 3a8c3a8f3..f17fedbc4 100644 --- a/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml +++ b/pitest-maven-verification/src/test/resources/pit-site-timestamped/pom.xml @@ -13,7 +13,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M1 + 3.12.0 diff --git a/pitest-maven/pom.xml b/pitest-maven/pom.xml index bd73b98dc..353a2050a 100644 --- a/pitest-maven/pom.xml +++ b/pitest-maven/pom.xml @@ -94,7 +94,7 @@ org.apache.maven.reporting maven-reporting-api - 4.0.0-M1 + 3.1.0 @@ -116,7 +116,7 @@ org.apache.maven.reporting maven-reporting-impl - 4.0.0-M1 + 3.1.0 backport-util-concurrent