Skip to content

Commit

Permalink
Enable to use java preview while executing built jar file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedla97 committed Oct 2, 2023
1 parent 9d0809f commit 0ecf282
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ protected List<String> prepareCommand(List<String> systemProperties) {
String[] cmdArgs = extractQuarkusArgs(systemProperties);
if (model.getArtifact().getFileName().toString().endsWith(".jar")) {
command.add(JAVA);
if (isEnabledPreview()) {
command.add("--enable-preview");
}
command.addAll(systemProperties);
command.add("-jar");
command.add(model.getArtifact().toAbsolutePath().toString());
Expand All @@ -51,4 +54,14 @@ private String[] extractQuarkusArgs(List<String> systemProperties) {

return args;
}

private boolean isEnabledPreview() {
String enablePreviewString = System.getProperty("--enable-preview");
if (enablePreviewString == null) {
return false;
} else if (!enablePreviewString.equals("true")) {
return false;
}
return true;
}
}

0 comments on commit 0ecf282

Please sign in to comment.