Skip to content

Commit

Permalink
Add a flag to enable UseServiceLoaderFeature, disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed Oct 25, 2018
1 parent b59935e commit 4120ac9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions maven/src/main/java/org/jboss/shamrock/maven/NativeImageMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public class NativeImageMojo extends AbstractMojo {
@Parameter(defaultValue = "false")
private boolean enableJni;

@Parameter(defaultValue = "false")
private boolean autoServiceLoaderRegistration;

@Parameter(defaultValue = "false")
private boolean dumpProxies;

Expand Down Expand Up @@ -182,12 +185,21 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (enableVMInspection) {
command.add("-H:+AllowVMInspection");
}
if (autoServiceLoaderRegistration) {
command.add("-H:+UseServiceLoaderFeature");
//When enabling, at least print what exactly is being added:
command.add("-H:+TraceServiceLoaderFeature");
}
else {
command.add("-H:-UseServiceLoaderFeature");
}
if (fullStackTraces) {
command.add("-H:+StackTrace");
}
else {
command.add("-H:-StackTrace");
}

System.out.println(command);
Process process = Runtime.getRuntime().exec(command.toArray(new String[0]), null, outputDirectory);
new Thread(new ProcessReader(process.getInputStream(), false)).start();
Expand Down

0 comments on commit 4120ac9

Please sign in to comment.