Skip to content

Commit

Permalink
Pass the local maven repo path to the tests as maven.repo.local syste…
Browse files Browse the repository at this point in the history
…m property and the maven command line args to the Maven Invoker invocation
  • Loading branch information
aloubyansky committed Mar 8, 2021
1 parent 0ec090d commit 16ea369
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo>${settings.localRepository}</maven.repo>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<project.version>${project.version}</project.version> <!-- some dev tools tests need this -->
</systemPropertyVariables>
<argLine>${jacoco.agent.argLine} -Xmx1500m</argLine> <!-- limit the amount of memory surefire can use, 1500m should be plenty-->
Expand All @@ -332,6 +333,7 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo>${settings.localRepository}</maven.repo>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<project.version>${project.version}</project.version> <!-- some dev tools tests need this -->
</systemPropertyVariables>
<!-- https://lists.apache.org/thread.html/r9030808273c82ac6d7b9602d34d446c7d8c4e8aa02c41bca164df1c5%40%3Cdev.maven.apache.org%3E -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private List<String> listExtensions()
+ ":list-extensions"));
getEnv().forEach(request::addShellEnvironment);
enableDevToolsTestConfig(request);
passMavenArgs(request);

File outputLog = new File(testDir, "output.log");
InvocationOutputHandler outputHandler = new PrintStreamHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -119,6 +120,7 @@ public MavenProcessInvocationResult execute(List<String> goals, Map<String, Stri
//just running GC
request.setMavenOpts("-Xmx128m");
}
MojoTestBase.passMavenArgs(request);

request.setShellEnvironmentInherited(true);
envVars.forEach(request::addShellEnvironment);
Expand Down

0 comments on commit 16ea369

Please sign in to comment.