Skip to content

Commit

Permalink
Merge pull request #14 from fchopard/master
Browse files Browse the repository at this point in the history
added support for restartOnCrash option
  • Loading branch information
lukaszlenart committed Dec 23, 2014
2 parents 197a4a2 + 8e1b22e commit a627bf9
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import net.sf.launch4j.BuilderException;
import net.sf.launch4j.config.Config;
import net.sf.launch4j.config.ConfigPersister;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
Expand Down Expand Up @@ -66,7 +65,7 @@ public class Launch4jMojo extends AbstractMojo {
* @readonly
*/
private Set dependencies;

/**
* The user's current project.
*
Expand Down Expand Up @@ -110,11 +109,11 @@ public class Launch4jMojo extends AbstractMojo {
* @component
*/
private ArtifactResolver resolver;

/**
* The dependencies of this plugin.
* The dependencies of this plugin.
* Used to get the Launch4j artifact version.
*
*
* @parameter default-value="${plugin.artifacts}" */
private java.util.List<Artifact> pluginArtifacts;

Expand Down Expand Up @@ -218,7 +217,7 @@ public class Launch4jMojo extends AbstractMojo {
*/
private String priority;


/**
* If true, the executable waits for the java application to finish before returning its exit code.
* Defaults to false for gui applications. Has no effect for console applications, which always wait.
Expand All @@ -227,6 +226,14 @@ public class Launch4jMojo extends AbstractMojo {
*/
private boolean stayAlive;

/**
* If true, when the application exits, any exit code other than 0 is considered a crash and
* the application will be started again.
*
* @parameter default-value=false
*/
private boolean restartOnCrash;

/**
* The icon to use in the taskbar. Must be in ico format.
*
Expand Down Expand Up @@ -284,7 +291,7 @@ public class Launch4jMojo extends AbstractMojo {
* @parameter
*/
private Splash splash;

/**
* Lots of information you can attach to the windows process.
*
Expand Down Expand Up @@ -324,8 +331,9 @@ public void execute() throws MojoExecutionException {
c.setSupportUrl(supportUrl);
c.setCmdLine(cmdLine);
c.setChdir(chdir);
c.setPriority(priority);
c.setPriority(priority);
c.setStayAlive(stayAlive);
c.setRestartOnCrash(restartOnCrash);
c.setManifest(manifest);
c.setIcon(icon);
c.setHeaderObjects(objs);
Expand Down Expand Up @@ -382,7 +390,7 @@ public void execute() throws MojoExecutionException {
* unpack it. Then different systems won't contend for the same space. But then I'll need to hack
* the l4j code so it permits passing in a work directory and doesn't always base it on
* the location of its own jarfile.
*
*
* @return the work directory.
*/
private File setupBuildEnvironment() throws MojoExecutionException {
Expand Down Expand Up @@ -522,7 +530,7 @@ private Artifact chooseBinaryBits() throws MojoExecutionException {
getLaunch4jVersion(), "jar", "workdir-" + plat);
}


private File getBaseDir() {
return basedir;
}
Expand All @@ -542,8 +550,9 @@ private void printState() {
log.debug("supportUrl = " + supportUrl);
log.debug("cmdLine = " + cmdLine);
log.debug("chdir = " + chdir);
log.debug("priority = " + priority);
log.debug("priority = " + priority);
log.debug("stayAlive = " + stayAlive);
log.debug("restartOnCrash = " + restartOnCrash);
log.debug("icon = " + icon);
log.debug("objs = " + objs);
log.debug("libs = " + libs);
Expand Down

0 comments on commit a627bf9

Please sign in to comment.