Skip to content

Commit 9e01ec4

Browse files
authored
Merge pull request #339 from Lilianne-Blaze/patch2-sensible-defaults1
Defaults for jre.path and headerType
2 parents 7fcbfe2 + 1ca902c commit 9e01ec4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public class Launch4jMojo extends AbstractMojo {
137137
* in order to avoid opening a DOS window.
138138
* Choosing gui also enables other options like taskbar icon and a splash screen.
139139
*/
140-
@Parameter
140+
@Parameter(defaultValue = "console", required = true)
141141
private String headerType;
142142

143143
/**
@@ -350,6 +350,8 @@ private void doExecute() throws MojoExecutionException {
350350
getLog().debug("Skipping execution of the plugin");
351351
return;
352352
}
353+
354+
fillSensibleJreDefaults();
353355

354356
if (!disableVersionInfoDefaults) {
355357
try {
@@ -491,6 +493,18 @@ private void doExecute() throws MojoExecutionException {
491493
}
492494
}
493495
}
496+
497+
private void fillSensibleJreDefaults() throws MojoExecutionException {
498+
if (jre == null) {
499+
jre = new Jre();
500+
}
501+
502+
if (jre.path == null) {
503+
String pathDef = "%JAVA_HOME%;%PATH%";
504+
getLog().warn("jre.path not set, defaulting to \"" + pathDef + "\"");
505+
jre.path = pathDef;
506+
}
507+
}
494508

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

0 commit comments

Comments
 (0)