From ff3490c889bd95575077a2e9f84d20f9b5831e26 Mon Sep 17 00:00:00 2001 From: anishthecoder Date: Fri, 28 Jan 2022 21:35:40 -0600 Subject: [PATCH 1/2] Create P2RepositoryPackagePlugin.java The argument index for `String.format` starts from `1`. In Java 11, index `0` defaulted to the first argument provided in the order. However, in Java 17, this throws `IllegalFormatArgumentIndexException` --- .../bestsolution/maven/osgi/pack/P2RepositoryPackagePlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/P2RepositoryPackagePlugin.java b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/P2RepositoryPackagePlugin.java index 9f60470..0c12aa3 100644 --- a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/P2RepositoryPackagePlugin.java +++ b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/P2RepositoryPackagePlugin.java @@ -66,7 +66,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { project.getArtifacts().stream().filter(this::pomFilter).forEach(a -> { String coloredOsgiFlag = getOsgiVerifier().isBundle(a) ? "true" : DebugSupport.TerminalOutputStyling.RED.style("false"); - String message = String.format("Processing artifact: %0$-70s - OSGI Bundle: %s", formatArtifact(a), coloredOsgiFlag); + String message = String.format("Processing artifact: %1$-70s - OSGI Bundle: %s", formatArtifact(a), coloredOsgiFlag); logger.debug(message); try (JarFile f = new JarFile(a.getFile())) { From b0b33687955c9d2318c5213a3f4b6e4d64a17407 Mon Sep 17 00:00:00 2001 From: "Anish V. Abraham" Date: Tue, 1 Feb 2022 17:50:23 -0600 Subject: [PATCH 2/2] Add the ability to specify VM options also. --- .../at/bestsolution/maven/osgi/pack/LauncherArgs.java | 1 + .../maven/osgi/pack/ProductPackagePlugin.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/LauncherArgs.java b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/LauncherArgs.java index 96a63ab..50d42f7 100644 --- a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/LauncherArgs.java +++ b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/LauncherArgs.java @@ -16,5 +16,6 @@ public class LauncherArgs { public List programArguments; public Properties vmProperties; + public List vmOptions; } diff --git a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/ProductPackagePlugin.java b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/ProductPackagePlugin.java index a560671..3a3c7c4 100644 --- a/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/ProductPackagePlugin.java +++ b/maven-osgi-package-plugin/src/main/java/at/bestsolution/maven/osgi/pack/ProductPackagePlugin.java @@ -69,12 +69,13 @@ public void execute() throws MojoExecutionException, MojoFailureException { Xpp3Dom programArgs = new Xpp3Dom("programArgs"); programArgs.setValue(product.launcherArgs.programArguments.stream().collect(Collectors.joining(" "))); launcherArgs.addChild(programArgs); - + Xpp3Dom vmArgs = new Xpp3Dom("vmArgs"); vmArgs.setValue( - product.launcherArgs.vmProperties.entrySet().stream() - .map( e -> "-D" + e.getKey() + "=" + e.getValue()) - .collect(Collectors.joining(" "))); + product.launcherArgs.vmOptions.stream().collect(Collectors.joining(" ")) + + product.launcherArgs.vmProperties.entrySet().stream() + .map( e -> "-D" + e.getKey() + "=" + e.getValue()) + .collect(Collectors.joining(" "))); launcherArgs.addChild(vmArgs); xppProduct.addChild(launcherArgs);