diff --git a/client/pom.xml b/client/pom.xml index 7e160d56..7bf01fb0 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -122,6 +122,7 @@ -H:IncludeResources=org/jboss/fuse/mvnd/.* -H:IncludeResources=org/jline/utils/.* -H:IncludeResources=org/fusesource/jansi/jansi.properties + -H:-ParseRuntimeOptions diff --git a/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java b/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java index 413eac9a..8ac63028 100644 --- a/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java +++ b/client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java @@ -88,7 +88,6 @@ public class DefaultClient implements Client { boolean version = false; boolean showVersion = false; boolean debug = false; - final Properties commandLineProperties = new Properties(); for (String arg : argv) { switch (arg) { case "-v": @@ -111,9 +110,9 @@ public class DefaultClient implements Client { if (arg.startsWith("-D")) { final int eqPos = arg.indexOf('='); if (eqPos >= 0) { - commandLineProperties.setProperty(arg.substring(2, eqPos), arg.substring(eqPos + 1)); + System.setProperty(arg.substring(2, eqPos), arg.substring(eqPos + 1)); } else { - commandLineProperties.setProperty(arg.substring(2), ""); + System.setProperty(arg.substring(2), ""); } } args.add(arg); diff --git a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java index 0fc82787..a6abda46 100644 --- a/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java +++ b/integration-tests/src/test/java/org/jboss/fuse/mvnd/it/ModuleAndPluginNativeIT.java @@ -42,11 +42,14 @@ public class ModuleAndPluginNativeIT { @Test void cleanInstall() throws IOException, InterruptedException { final Path helloPath = layout.multiModuleProjectDirectory().resolve("hello/target/hello.txt"); - try { - Files.deleteIfExists(helloPath); - } catch (IOException e) { - throw new RuntimeException("Could not delete " + helloPath); - } + final Path helloPropertyPath = layout.multiModuleProjectDirectory().resolve("hello/target/hello.property.txt"); + Stream.of(helloPath, helloPropertyPath).forEach(p -> { + try { + Files.deleteIfExists(p); + } catch (IOException e) { + throw new RuntimeException("Could not delete " + p); + } + }); final Path localMavenRepo = layout.getLocalMavenRepository(); TestUtils.deleteDir(localMavenRepo); @@ -59,10 +62,13 @@ public class ModuleAndPluginNativeIT { /* Build #1: with "Hello" output to target/hello.txt */ { final ClientOutput output = Mockito.mock(ClientOutput.class); - client.execute(output, "clean", "install", "-e", "-Dmvnd.log.level=DEBUG").assertSuccess(); + client.execute(output, "clean", "install", "-e", "-Dmvnd.log.level=DEBUG", "-Dhello.property=Hello1") + .assertSuccess(); Assertions.assertThat(helloPath).exists(); Assertions.assertThat(helloPath).usingCharset(StandardCharsets.UTF_8).hasContent("Hello"); + Assertions.assertThat(helloPropertyPath).exists(); + Assertions.assertThat(helloPropertyPath).usingCharset(StandardCharsets.UTF_8).hasContent("Hello1"); Stream.of(installedJars).forEach(jar -> Assertions.assertThat(jar).exists()); } @@ -75,10 +81,12 @@ public class ModuleAndPluginNativeIT { final ClientOutput output = Mockito.mock(ClientOutput.class); client.execute(output, "clean", - "install", "-e", "-Dmvnd.log.level=DEBUG").assertSuccess(); + "install", "-e", "-Dmvnd.log.level=DEBUG", "-Dhello.property=Hello2").assertSuccess(); Assertions.assertThat(helloPath).exists(); Assertions.assertThat(helloPath).usingCharset(StandardCharsets.UTF_8).hasContent("Hi"); + Assertions.assertThat(helloPropertyPath).exists(); + Assertions.assertThat(helloPropertyPath).usingCharset(StandardCharsets.UTF_8).hasContent("Hello2"); Stream.of(installedJars).forEach(jar -> Assertions.assertThat(jar).exists()); } diff --git a/integration-tests/src/test/projects/module-and-plugin/plugin/src/main/java/org/jboss/fuse/mvnd/test/module/plugin/mojo/HelloMojo.java b/integration-tests/src/test/projects/module-and-plugin/plugin/src/main/java/org/jboss/fuse/mvnd/test/module/plugin/mojo/HelloMojo.java index 1e064b2a..a9efb854 100644 --- a/integration-tests/src/test/projects/module-and-plugin/plugin/src/main/java/org/jboss/fuse/mvnd/test/module/plugin/mojo/HelloMojo.java +++ b/integration-tests/src/test/projects/module-and-plugin/plugin/src/main/java/org/jboss/fuse/mvnd/test/module/plugin/mojo/HelloMojo.java @@ -35,6 +35,9 @@ public class HelloMojo extends AbstractMojo { @Parameter File file; + @Parameter(property = "hello.property", defaultValue = "Hello") + String property; + @Override public void execute() throws MojoExecutionException, MojoFailureException { @@ -42,6 +45,7 @@ public class HelloMojo extends AbstractMojo { final Path path = file.toPath(); Files.createDirectories(path.getParent()); Files.write(path, "Hello".getBytes(StandardCharsets.UTF_8)); + Files.write(path.getParent().resolve("hello.property.txt"), property.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new RuntimeException("", e); }