diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml index ed302a6ef7..cd7c7a51cc 100644 --- a/maven-failsafe-plugin/pom.xml +++ b/maven-failsafe-plugin/pom.xml @@ -114,7 +114,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml index d146c16350..bdaf15b728 100644 --- a/maven-surefire-common/pom.xml +++ b/maven-surefire-common/pom.xml @@ -53,10 +53,9 @@ provided - org.eclipse.aether - aether-util - - 1.0.0.v20140518 + org.apache.maven.resolver + maven-resolver-util + ${resolverVersion} org.apache.maven.plugin-tools @@ -154,7 +153,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index 6dff7cadc1..7cd860960a 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; import java.math.BigDecimal; import java.nio.file.Files; import java.util.ArrayList; @@ -139,8 +138,6 @@ import static org.apache.maven.surefire.api.booter.ProviderParameterNames.INCLUDE_JUNIT5_ENGINES_PROP; import static org.apache.maven.surefire.api.suite.RunResult.failure; import static org.apache.maven.surefire.api.suite.RunResult.noTestsRun; -import static org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray; -import static org.apache.maven.surefire.api.util.ReflectionUtils.tryGetMethod; import static org.apache.maven.surefire.booter.Classpath.emptyClasspath; import static org.apache.maven.surefire.booter.SystemUtils.endsWithJavaPath; import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava9AtLeast; @@ -935,31 +932,17 @@ protected final PluginConsoleLogger getConsoleLogger() { return consoleLogger; } - private static Toolchain getToolchainMaven33x( - Class toolchainManagerType, T toolchainManager, MavenSession session, Map toolchainArgs) - throws MojoFailureException { - Method getToolchainsMethod = - tryGetMethod(toolchainManagerType, "getToolchains", MavenSession.class, String.class, Map.class); - if (getToolchainsMethod != null) { - //noinspection unchecked - List tcs = - invokeMethodWithArray(toolchainManager, getToolchainsMethod, session, "jdk", toolchainArgs); - if (tcs.isEmpty()) { - throw new MojoFailureException( - "Requested toolchain specification did not match any configured toolchain: " + toolchainArgs); - } - return tcs.get(0); - } - return null; - } - - // TODO remove the part with ToolchainManager lookup once we depend on - // 3.0.9 (have it as prerequisite). Define as regular component field then. private Toolchain getToolchain() throws MojoFailureException { Toolchain tc = null; if (getJdkToolchain() != null) { - tc = getToolchainMaven33x(ToolchainManager.class, getToolchainManager(), getSession(), getJdkToolchain()); + List tcs = getToolchainManager().getToolchains(getSession(), "jdk", getJdkToolchain()); + if (tcs.isEmpty()) { + throw new MojoFailureException( + "Requested toolchain specification did not match any configured toolchain: " + + getJdkToolchain()); + } + tc = tcs.get(0); } if (tc == null) { diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoToolchainsTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoToolchainsTest.java index 822c709eba..954bf58722 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoToolchainsTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoToolchainsTest.java @@ -32,6 +32,7 @@ import org.apache.maven.toolchain.ToolchainManager; import org.apache.maven.toolchain.java.DefaultJavaToolChain; import org.codehaus.plexus.logging.Logger; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -42,17 +43,14 @@ import org.powermock.modules.junit4.PowerMockRunner; import static java.io.File.separatorChar; -import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; -import static junit.framework.TestCase.assertNull; import static org.apache.maven.surefire.booter.SystemUtils.toJdkHomeFromJre; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.CoreMatchers.startsWith; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.powermock.api.mockito.PowerMockito.mock; -import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.api.mockito.PowerMockito.when; import static org.powermock.reflect.Whitebox.invokeMethod; @@ -67,28 +65,18 @@ public class AbstractSurefireMojoToolchainsTest { public final ExpectedException e = ExpectedException.none(); /** - * Ensure that we use the toolchain found by getToolchainMaven33x() + * Ensure that we use the toolchain found by getToolchain() * when the jdkToolchain parameter is set. */ @Test - public void shouldCallMaven33xMethodWhenSpecSet() throws Exception { + public void shouldCallMethodWhenSpecSet() throws Exception { AbstractSurefireMojoTest.Mojo mojo = new AbstractSurefireMojoTest.Mojo(); - Toolchain expectedFromMaven33Method = mock(Toolchain.class); - MockToolchainManager toolchainManager = new MockToolchainManager(null, null); + Toolchain expectedMethod = mock(Toolchain.class); + MockToolchainManager toolchainManager = new MockToolchainManager(expectedMethod, null); mojo.setToolchainManager(toolchainManager); mojo.setJdkToolchain(singletonMap("version", "1.8")); - - mockStatic(AbstractSurefireMojo.class); - when( - AbstractSurefireMojo.class, - "getToolchainMaven33x", - ToolchainManager.class, - toolchainManager, - mojo.getSession(), - mojo.getJdkToolchain()) - .thenReturn(expectedFromMaven33Method); Toolchain actual = invokeMethod(mojo, "getToolchain"); - assertThat(actual).isSameAs(expectedFromMaven33Method); + assertThat(actual).isSameAs(expectedMethod); } /** @@ -106,39 +94,19 @@ public void shouldFallthroughToBuildContextWhenNoSpecSet() throws Exception { assertThat(actual).isSameAs(expectedFromContext); } - @Test - public void shouldReturnNoToolchainInMaven32() throws Exception { - Toolchain toolchain = invokeMethod( - AbstractSurefireMojo.class, - "getToolchainMaven33x", - MockToolchainManagerMaven32.class, - new MockToolchainManagerMaven32(null), - mock(MavenSession.class), - emptyMap()); - assertNull(toolchain); - } - + // TODO Is this still required? @Test(expected = MojoFailureException.class) - public void shouldThrowMaven33xToolchain() throws Exception { - invokeMethod( - AbstractSurefireMojo.class, - "getToolchainMaven33x", - MockToolchainManager.class, - new MockToolchainManager(null, null), - mock(MavenSession.class), - emptyMap()); + @Ignore + public void shouldThrowToolchain() throws Exception { + invokeMethod(AbstractSurefireMojo.class, "getToolchain"); } + // TODO Is this still required? @Test - public void shouldGetMaven33xToolchain() throws Exception { + @Ignore + public void shouldGetToolchain() throws Exception { Toolchain expected = mock(Toolchain.class); - Toolchain actual = invokeMethod( - AbstractSurefireMojo.class, - "getToolchainMaven33x", - MockToolchainManager.class, - new MockToolchainManager(expected, null), - mock(MavenSession.class), - emptyMap()); + Toolchain actual = invokeMethod(AbstractSurefireMojo.class, "getToolchain"); assertThat(actual).isSameAs(expected); } @@ -257,28 +225,13 @@ public void shouldFailWithWrongJvmExecPath() throws Exception { /** * Mocks a ToolchainManager */ - public static final class MockToolchainManager extends MockToolchainManagerMaven32 { + public static final class MockToolchainManager implements ToolchainManager { + private final Toolchain specToolchain; + private final Toolchain buildContextToolchain; public MockToolchainManager(Toolchain specToolchain, Toolchain buildContextToolchain) { - super(buildContextToolchain); this.specToolchain = specToolchain; - } - - public List getToolchains(MavenSession session, String type, Map requirements) { - return specToolchain == null ? Collections.emptyList() : singletonList(specToolchain); - } - } - - /** - * Mocks an older version that does not implement getToolchains() - * returns provided toolchain - */ - public static class MockToolchainManagerMaven32 implements ToolchainManager { - - private final Toolchain buildContextToolchain; - - public MockToolchainManagerMaven32(Toolchain buildContextToolchain) { this.buildContextToolchain = buildContextToolchain; } @@ -286,5 +239,10 @@ public MockToolchainManagerMaven32(Toolchain buildContextToolchain) { public Toolchain getToolchainFromBuildContext(String type, MavenSession context) { return buildContextToolchain; } + + @Override + public List getToolchains(MavenSession session, String type, Map requirements) { + return specToolchain == null ? Collections.emptyList() : singletonList(specToolchain); + } } } diff --git a/maven-surefire-plugin/pom.xml b/maven-surefire-plugin/pom.xml index 3778015173..f0a9a06813 100644 --- a/maven-surefire-plugin/pom.xml +++ b/maven-surefire-plugin/pom.xml @@ -86,7 +86,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index 12be3c4d00..7068556dc5 100644 --- a/maven-surefire-report-plugin/pom.xml +++ b/maven-surefire-report-plugin/pom.xml @@ -47,7 +47,6 @@ 1.12.0 - 1.0.0.v20140518 @@ -124,21 +123,21 @@ test - org.eclipse.aether - aether-impl - ${aetherVersion} + org.apache.maven.resolver + maven-resolver-impl + ${resolverVersion} test - org.eclipse.aether - aether-connector-basic - ${aetherVersion} + org.apache.maven.resolver + maven-resolver-connector-basic + ${resolverVersion} test - org.eclipse.aether - aether-transport-wagon - ${aetherVersion} + org.apache.maven.resolver + maven-resolver-transport-wagon + ${resolverVersion} test @@ -187,7 +186,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/pom.xml b/pom.xml index bb7164ed53..8f08f20279 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven maven-parent - 41 + 42 org.apache.maven.surefire @@ -88,7 +88,8 @@ 8 - 3.2.5 + 3.6.3 + 1.4.1 3.14.0 1.26.1 2.16.1 @@ -358,7 +359,7 @@ maven-surefire-plugin - 3.2.2 + 3.2.5 @@ -505,7 +506,7 @@ org.apache.maven.plugins maven-surefire-report-plugin - 3.2.2 + 3.2.5 diff --git a/surefire-api/pom.xml b/surefire-api/pom.xml index 274bff1c9a..1a679ac262 100644 --- a/surefire-api/pom.xml +++ b/surefire-api/pom.xml @@ -88,7 +88,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml index ba2a280515..c38bf2acc6 100644 --- a/surefire-booter/pom.xml +++ b/surefire-booter/pom.xml @@ -116,7 +116,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-extensions-api/pom.xml b/surefire-extensions-api/pom.xml index 6c271b29df..167b5cb26a 100644 --- a/surefire-extensions-api/pom.xml +++ b/surefire-extensions-api/pom.xml @@ -82,7 +82,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-grouper/pom.xml b/surefire-grouper/pom.xml index b3379726ec..37af09e8b6 100644 --- a/surefire-grouper/pom.xml +++ b/surefire-grouper/pom.xml @@ -77,7 +77,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index 205bbf1a03..1c9f53b0f6 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -39,7 +39,7 @@ org.apache.maven.surefire surefire-report-parser - 3.2.2 + 3.2.5 test @@ -128,7 +128,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 @@ -176,7 +176,7 @@ maven-failsafe-plugin - 3.2.2 + 3.2.5 ${skipTests} @@ -205,7 +205,7 @@ org.apache.maven.surefire surefire-junit47 - 3.2.2 + 3.2.5 diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java index d6513b1671..38eb553d00 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java @@ -80,6 +80,7 @@ public static Iterable artifactVersions() { args.add(new Object[] {"1.7.2", "5.7.2", "1.2.0", "1.1.0"}); args.add(new Object[] {"1.8.2", "5.8.2", "1.2.0", "1.1.2"}); args.add(new Object[] {"1.9.1", "5.9.1", "1.2.0", "1.1.2"}); + args.add(new Object[] {"1.10.2", "5.10.2", "1.3.0", "1.1.2"}); return args; } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java index dcdefe36d2..2f5774bd8c 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java @@ -56,6 +56,8 @@ public static Iterable artifactVersions() { args.add(new Object[] {"5.7.2", "1.5.5"}); args.add(new Object[] {"5.8.2", "1.6.5"}); args.add(new Object[] {"5.9.1", "1.7.1"}); + args.add(new Object[] {"5.10.2", "1.8.5"}); + args.add(new Object[] {"5.11.0-M2", "1.8.5"}); return args; } diff --git a/surefire-its/src/test/resources/junit-4-5/pom.xml b/surefire-its/src/test/resources/junit-4-5/pom.xml index f202a4c962..9a9d69c275 100644 --- a/surefire-its/src/test/resources/junit-4-5/pom.xml +++ b/surefire-its/src/test/resources/junit-4-5/pom.xml @@ -124,6 +124,11 @@ junit-vintage-engine 5.9.1 + + org.junit.platform + junit-platform-engine + 1.9.1 + @@ -156,6 +161,11 @@ junit-jupiter-engine 5.9.1 + + org.junit.platform + junit-platform-engine + 1.9.1 + diff --git a/surefire-its/src/test/resources/junit5-suite/pom.xml b/surefire-its/src/test/resources/junit5-suite/pom.xml index de764eff7f..c0b1106a7e 100644 --- a/surefire-its/src/test/resources/junit5-suite/pom.xml +++ b/surefire-its/src/test/resources/junit5-suite/pom.xml @@ -80,6 +80,11 @@ junit-jupiter-engine 5.8.2 + + org.junit.platform + junit-platform-engine + 1.8.2 + org.junit.platform junit-platform-suite diff --git a/surefire-logger-api/pom.xml b/surefire-logger-api/pom.xml index 2a2c7283e2..ddd422347f 100644 --- a/surefire-logger-api/pom.xml +++ b/surefire-logger-api/pom.xml @@ -84,7 +84,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/common-java5/pom.xml b/surefire-providers/common-java5/pom.xml index 7e9f2ebf8f..41832bd831 100644 --- a/surefire-providers/common-java5/pom.xml +++ b/surefire-providers/common-java5/pom.xml @@ -65,7 +65,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/common-junit3/pom.xml b/surefire-providers/common-junit3/pom.xml index 04b597d664..8c2b1a9d57 100644 --- a/surefire-providers/common-junit3/pom.xml +++ b/surefire-providers/common-junit3/pom.xml @@ -66,7 +66,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/common-junit4/pom.xml b/surefire-providers/common-junit4/pom.xml index c9cb75932f..eb02895ddf 100644 --- a/surefire-providers/common-junit4/pom.xml +++ b/surefire-providers/common-junit4/pom.xml @@ -76,7 +76,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/common-junit48/pom.xml b/surefire-providers/common-junit48/pom.xml index cf05a965bf..bc17a8a938 100644 --- a/surefire-providers/common-junit48/pom.xml +++ b/surefire-providers/common-junit48/pom.xml @@ -119,7 +119,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/pom.xml b/surefire-providers/pom.xml index 4b864f84fb..5efc7470b8 100644 --- a/surefire-providers/pom.xml +++ b/surefire-providers/pom.xml @@ -61,7 +61,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/surefire-junit3/pom.xml b/surefire-providers/surefire-junit3/pom.xml index 05bf62e61e..f753ab6594 100644 --- a/surefire-providers/surefire-junit3/pom.xml +++ b/surefire-providers/surefire-junit3/pom.xml @@ -76,7 +76,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/surefire-junit4/pom.xml b/surefire-providers/surefire-junit4/pom.xml index d91d235138..f4c7c2fcd3 100644 --- a/surefire-providers/surefire-junit4/pom.xml +++ b/surefire-providers/surefire-junit4/pom.xml @@ -74,7 +74,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/surefire-junit47/pom.xml b/surefire-providers/surefire-junit47/pom.xml index a2a526ca2b..80a5237f61 100644 --- a/surefire-providers/surefire-junit47/pom.xml +++ b/surefire-providers/surefire-junit47/pom.xml @@ -92,7 +92,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/surefire-testng-utils/pom.xml b/surefire-providers/surefire-testng-utils/pom.xml index a382b674f6..26c3f43957 100644 --- a/surefire-providers/surefire-testng-utils/pom.xml +++ b/surefire-providers/surefire-testng-utils/pom.xml @@ -78,7 +78,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml index de74f5919d..2380c356ba 100644 --- a/surefire-providers/surefire-testng/pom.xml +++ b/surefire-providers/surefire-testng/pom.xml @@ -94,7 +94,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5 diff --git a/surefire-report-parser/pom.xml b/surefire-report-parser/pom.xml index b9b209dce4..8844a699f7 100644 --- a/surefire-report-parser/pom.xml +++ b/surefire-report-parser/pom.xml @@ -71,7 +71,7 @@ org.apache.maven.surefire surefire-shadefire - 3.2.2 + 3.2.5