mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 13:15:27 +00:00
mvnd native executable is not passing -Dkey=val to the daemon #157
This commit is contained in:
@@ -122,6 +122,7 @@
|
||||
-H:IncludeResources=org/jboss/fuse/mvnd/.*
|
||||
-H:IncludeResources=org/jline/utils/.*
|
||||
-H:IncludeResources=org/fusesource/jansi/jansi.properties
|
||||
-H:-ParseRuntimeOptions
|
||||
</buildArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -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);
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user