From 16ea369cb92f047c7a37bd4ef186a6a015a61c40 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Mon, 8 Mar 2021 10:39:21 +0100 Subject: [PATCH] Pass the local maven repo path to the tests as maven.repo.local system property and the maven command line args to the Maven Invoker invocation --- build-parent/pom.xml | 2 ++ .../java/io/quarkus/maven/it/AddExtensionIT.java | 1 + .../io/quarkus/maven/it/CreateExtensionMojoIT.java | 1 + .../quarkus/maven/it/CreateJBangProjectMojoIT.java | 1 + .../maven/it/CreateProjectCodestartMojoIT.java | 1 + .../io/quarkus/maven/it/CreateProjectMojoIT.java | 1 + .../java/io/quarkus/maven/it/GenerateConfigIT.java | 1 + .../java/io/quarkus/maven/it/ListExtensionsIT.java | 1 + .../main/java/io/quarkus/maven/it/MojoTestBase.java | 12 ++++++++++++ .../io/quarkus/maven/it/verifier/RunningInvoker.java | 2 ++ 10 files changed, 23 insertions(+) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index a06f7308e1060b..39e6f80a01f90d 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -317,6 +317,7 @@ org.jboss.logmanager.LogManager ${maven.home} ${settings.localRepository} + ${settings.localRepository} ${project.version} ${jacoco.agent.argLine} -Xmx1500m @@ -332,6 +333,7 @@ org.jboss.logmanager.LogManager ${maven.home} ${settings.localRepository} + ${settings.localRepository} ${project.version} diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/AddExtensionIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/AddExtensionIT.java index e2202e8a55430b..93d24717ee9407 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/AddExtensionIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/AddExtensionIT.java @@ -140,6 +140,7 @@ private void addExtension(boolean plural, String ext) properties.setProperty("extension", ext); } enableDevToolsTestConfig(properties); + passMavenArgs(properties); request.setProperties(properties); getEnv().forEach(request::addShellEnvironment); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateExtensionMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateExtensionMojoIT.java index 02bc20d3eb9c61..b77c0d8dbf2b79 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateExtensionMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateExtensionMojoIT.java @@ -114,6 +114,7 @@ private InvocationResult setup(Properties params) + ":create-extension")); request.setDebug(false); request.setShowErrors(true); + passMavenArgs(params); request.setProperties(params); getEnv().forEach(request::addShellEnvironment); File log = new File(testDir.getParent(), "build-create-extension-" + testDir.getName() + ".log"); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateJBangProjectMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateJBangProjectMojoIT.java index 760dc86d0b2dd7..9d2bbf27431a38 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateJBangProjectMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateJBangProjectMojoIT.java @@ -52,6 +52,7 @@ private InvocationResult setup(Properties params) request.setDebug(false); request.setShowErrors(true); enableDevToolsTestConfig(params); + passMavenArgs(params); request.setProperties(params); getEnv().forEach(request::addShellEnvironment); File log = new File(testDir, "build-create-" + testDir.getName() + ".log"); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectCodestartMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectCodestartMojoIT.java index 3748ed2a673da8..97d3c11a5c399b 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectCodestartMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectCodestartMojoIT.java @@ -161,6 +161,7 @@ private InvocationResult executeCreate(Properties params) request.setDebug(false); request.setShowErrors(true); enableDevToolsTestConfig(params); + passMavenArgs(params); request.setProperties(params); getEnv().forEach(request::addShellEnvironment); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java index dd73536b451f03..c66b4758f5f722 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java @@ -440,6 +440,7 @@ private InvocationResult setup(Properties params) request.setDebug(false); request.setShowErrors(true); enableDevToolsTestConfig(params); + passMavenArgs(params); request.setProperties(params); getEnv().forEach(request::addShellEnvironment); File log = new File(testDir, "build-create-" + testDir.getName() + ".log"); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/GenerateConfigIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/GenerateConfigIT.java index af3b7dec400742..4ab660294fdddc 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/GenerateConfigIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/GenerateConfigIT.java @@ -66,6 +66,7 @@ private void generateConfig(String filename) + getMavenPluginVersion() + ":generate-config")); Properties properties = new Properties(); properties.setProperty("file", filename); + passMavenArgs(properties); request.setProperties(properties); getEnv().forEach(request::addShellEnvironment); File log = new File(testDir, "build-generate-config-" + testDir.getName() + ".log"); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/ListExtensionsIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/ListExtensionsIT.java index 0f684b26134dd6..3088d84244bc0b 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/ListExtensionsIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/ListExtensionsIT.java @@ -66,6 +66,7 @@ private List listExtensions() + ":list-extensions")); getEnv().forEach(request::addShellEnvironment); enableDevToolsTestConfig(request); + passMavenArgs(request); File outputLog = new File(testDir, "output.log"); InvocationOutputHandler outputHandler = new PrintStreamHandler( diff --git a/test-framework/maven/src/main/java/io/quarkus/maven/it/MojoTestBase.java b/test-framework/maven/src/main/java/io/quarkus/maven/it/MojoTestBase.java index 19edbdb96387f7..4b35907349b838 100644 --- a/test-framework/maven/src/main/java/io/quarkus/maven/it/MojoTestBase.java +++ b/test-framework/maven/src/main/java/io/quarkus/maven/it/MojoTestBase.java @@ -26,6 +26,7 @@ import org.apache.maven.shared.invoker.Invoker; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions; import io.quarkus.devtools.test.RegistryClientTestHelper; import io.quarkus.test.devmode.util.DevModeTestUtils; @@ -42,6 +43,17 @@ public static Invoker initInvoker(File root) { return invoker; } + public static void passMavenArgs(InvocationRequest request) { + passMavenArgs(request.getProperties()); + } + + public static void passMavenArgs(Properties props) { + final String mvnArgs = BootstrapMavenOptions.getMavenCmdLine(); + if (mvnArgs != null) { + props.setProperty(BootstrapMavenOptions.QUARKUS_INTERNAL_MAVEN_CMD_LINE_ARGS, mvnArgs); + } + } + public static File initEmptyProject(String name) { File tc = new File("target/test-classes/" + name); if (tc.isDirectory()) { diff --git a/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/RunningInvoker.java b/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/RunningInvoker.java index 93a10d92bad24f..b9b0d447196d7f 100644 --- a/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/RunningInvoker.java +++ b/test-framework/maven/src/main/java/io/quarkus/maven/it/verifier/RunningInvoker.java @@ -20,6 +20,7 @@ import org.apache.maven.shared.invoker.PrintStreamHandler; import org.apache.maven.shared.invoker.PrintStreamLogger; +import io.quarkus.maven.it.MojoTestBase; import io.quarkus.test.devmode.util.DevModeTestUtils; /** @@ -119,6 +120,7 @@ public MavenProcessInvocationResult execute(List goals, Map