Skip to content

Commit

Permalink
Merge pull request orphan-oss#339 from Lilianne-Blaze/patch2-sensible…
Browse files Browse the repository at this point in the history
…-defaults1

Defaults for jre.path and headerType
  • Loading branch information
lukaszlenart authored Jan 15, 2024
2 parents 7fcbfe2 + 1ca902c commit 9e01ec4
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class Launch4jMojo extends AbstractMojo {
* in order to avoid opening a DOS window.
* Choosing gui also enables other options like taskbar icon and a splash screen.
*/
@Parameter
@Parameter(defaultValue = "console", required = true)
private String headerType;

/**
Expand Down Expand Up @@ -350,6 +350,8 @@ private void doExecute() throws MojoExecutionException {
getLog().debug("Skipping execution of the plugin");
return;
}

fillSensibleJreDefaults();

if (!disableVersionInfoDefaults) {
try {
Expand Down Expand Up @@ -491,6 +493,18 @@ private void doExecute() throws MojoExecutionException {
}
}
}

private void fillSensibleJreDefaults() throws MojoExecutionException {
if (jre == null) {
jre = new Jre();
}

if (jre.path == null) {
String pathDef = "%JAVA_HOME%;%PATH%";
getLog().warn("jre.path not set, defaulting to \"" + pathDef + "\"");
jre.path = pathDef;
}
}

/**
* Prepares a little directory for launch4j to do its thing. Launch4j needs a bunch of object files
Expand Down

0 comments on commit 9e01ec4

Please sign in to comment.