diff --git a/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java b/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java index 2f4b1463a..5bd230557 100644 --- a/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java +++ b/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java @@ -132,9 +132,11 @@ public static void main(String[] argv) throws Exception { } else { dir = parameters.userDir(); } + Path multiModuleProjectDirectory = parameters.multiModuleProjectDirectory(dir); System.setProperty( - Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.getProperty(), - parameters.multiModuleProjectDirectory(dir).toString()); + Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.getProperty(), multiModuleProjectDirectory.toString()); + Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.addCommandLineOption( + args, multiModuleProjectDirectory.toString()); // .mvn/jvm.config if (Files.isRegularFile(parameters.jvmConfigPath())) { diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfIgnoreExtNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfIgnoreExtNativeIT.java index 80f6495d8..2e8085795 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfIgnoreExtNativeIT.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfIgnoreExtNativeIT.java @@ -26,8 +26,8 @@ @MvndNativeTest(projectDir = "src/test/projects/maven-conf-ignore-ext") class MavenConfIgnoreExtNativeIT extends MavenConfNativeIT { @Override - protected List mvndParams() { - ArrayList result = new ArrayList<>(super.mvndParams()); + protected List mvndParams(String expression) { + ArrayList result = new ArrayList<>(super.mvndParams(expression)); result.add("-Dmvnd.coreExtensionsExclude=foo:bar"); return result; } diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfNativeIT.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfNativeIT.java index 4a6e5da78..183eca400 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfNativeIT.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MavenConfNativeIT.java @@ -20,7 +20,6 @@ import javax.inject.Inject; -import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -42,7 +41,7 @@ class MavenConfNativeIT { DaemonParameters parameters; @Test - void version() throws IOException, InterruptedException { + void version() throws InterruptedException { final TestClientOutput o = new TestClientOutput(); // this test also exercise the "-D foo=bar" syntax for defining properties client.execute(o, mvndParams().toArray(new String[0])).assertSuccess(); @@ -51,11 +50,34 @@ void version() throws IOException, InterruptedException { o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf); } + @Test + void interpolation() throws InterruptedException { + final TestClientOutput o = new TestClientOutput(); + client.execute(o, mvndParams("something").toArray(new String[0])).assertSuccess(); + String conf = parameters.multiModuleProjectDirectory().toString(); + assertTrue( + o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf); + } + + @Test + void multiModuleProjectDirectory() throws InterruptedException { + final TestClientOutput o = new TestClientOutput(); + client.execute(o, mvndParams("maven.multiModuleProjectDirectory").toArray(new String[0])) + .assertSuccess(); + String conf = parameters.multiModuleProjectDirectory().toString(); + assertTrue( + o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf); + } + protected List mvndParams() { + return mvndParams("maven.conf"); + } + + protected List mvndParams(String expression) { return Arrays.asList( "org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate", "-D", - "expression=maven.conf", + "expression=" + expression, "-q", "-DforceStdout", "--raw-streams",