Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A complete copy of this license may be found in src/main/legal/LICENSE.txt of th
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
Expand All @@ -37,7 +37,7 @@ A complete copy of this license may be found in src/main/legal/LICENSE.txt of th

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<launch4j.version>3.50</launch4j.version>
<launch4j.version>3.51</launch4j.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/akathist/maven/plugins/launch4j/Jre.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.List;

import net.sf.launch4j.config.JreMode;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Parameter;

Expand All @@ -40,6 +41,12 @@ public class Jre {
@Parameter(required = true)
String path;

/**
* JRE mode: "server" or "client".
*/
@Parameter(defaultValue = "CLIENT")
String mode;

/**
* Sets jre's bundledJre64Bit flag
*
Expand Down Expand Up @@ -174,6 +181,7 @@ net.sf.launch4j.config.Jre toL4j() {
net.sf.launch4j.config.Jre ret = new net.sf.launch4j.config.Jre();

ret.setPath(path);
ret.setMode(JreMode.valueOf(mode.toUpperCase()));
ret.setRequires64Bit(requires64Bit);
ret.setMinVersion(minVersion);
ret.setMaxVersion(maxVersion);
Expand All @@ -191,6 +199,7 @@ net.sf.launch4j.config.Jre toL4j() {
public String toString() {
return "Jre{" +
"path='" + path + '\'' +
", mode=" + mode +
", requires64Bit=" + requires64Bit +
", minVersion='" + minVersion + '\'' +
", maxVersion='" + maxVersion + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.akathist.maven.plugins.launch4j.tools.ResourceIO;
import net.sf.launch4j.Builder;
import net.sf.launch4j.BuilderException;
import net.sf.launch4j.config.Architecture;
import net.sf.launch4j.config.Config;
import net.sf.launch4j.config.ConfigPersister;
import net.sf.launch4j.config.ConfigPersisterException;
Expand Down Expand Up @@ -140,7 +141,7 @@ public class Launch4jMojo extends AbstractMojo {

/**
* Whether you want a gui or console app.
* Valid values are "gui" and "console."
* Valid values are "gui", "console", "jniGui", "jniConsole".
* If you say gui, then launch4j will run your app from javaw instead of java
* in order to avoid opening a DOS window.
* Choosing gui also enables other options like taskbar icon and a splash screen.
Expand All @@ -162,6 +163,13 @@ public class Launch4jMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.build.directory}/${project.artifactId}.exe")
private File outfile;

/**
* The architecture of executable you want launch4j to produce.
* Default is WIN32.
*/
@Parameter(defaultValue = "WIN32")
private Architecture outfileArch;

/**
* The jar to bundle inside the executable.
* The path, if relative, is relative to the pom.xml.
Expand Down Expand Up @@ -411,6 +419,10 @@ private void doExecute() throws MojoExecutionException {
c.setOutfile(outfile);
}

if (outfileArch != null) {
c.setOutfileArch(outfileArch);
}

if (icon != null) {
c.setIcon(icon);
}
Expand Down Expand Up @@ -448,6 +460,7 @@ private void doExecute() throws MojoExecutionException {

c.setHeaderType(headerType);
c.setOutfile(outfile);
c.setOutfileArch(outfileArch);
c.setJar(getJar());
c.setDontWrapJar(dontWrapJar);
c.setErrTitle(errTitle);
Expand Down Expand Up @@ -771,7 +784,11 @@ private Artifact chooseBinaryBits() throws MojoExecutionException {
// See here for possible values of os.name:
// http://lopica.sourceforge.net/os.html
if (os.startsWith("Windows")) {
plat = "win32";
if ("amd64".equals(arch)) {
plat = "win64";
} else {
plat = "win32";
}
} else if ("Linux".equals(os)) {
if ("amd64".equals(arch)) {
plat = "linux64";
Expand Down Expand Up @@ -809,6 +826,7 @@ private void printState() {

log.debug("headerType = " + c.getHeaderType());
log.debug("outfile = " + c.getOutfile());
log.debug("outfileArch = " + c.getOutfileArch());
log.debug("jar = " + c.getJar());
log.debug("dontWrapJar = " + c.isDontWrapJar());
log.debug("errTitle = " + c.getErrTitle());
Expand Down Expand Up @@ -940,6 +958,7 @@ public String toString() {
"headerType='" + headerType + '\'' +
", infile=" + infile +
", outfile=" + outfile +
", outfileArch=" + outfileArch +
", jar='" + jar + '\'' +
", dontWrapJar=" + dontWrapJar +
", errTitle='" + errTitle + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void testPrintOutFulfilledConfiguration() throws Exception {
"headerType='gui', " +
"infile=null, " +
"outfile=${project.build.directory}" + File.separator + "app.exe, " +
"outfileArch=WIN32, " +
"jar='${project.build.directory}/${project.artifactId}-${project.version}.jar', " +
"dontWrapJar=false, " +
"errTitle='null', " +
Expand All @@ -51,6 +52,7 @@ public void testPrintOutFulfilledConfiguration() throws Exception {
"vars=null, " +
"jre=Jre{" +
"path='%JAVA_HOME%;%PATH%', " +
"mode=client, " +
"requires64Bit=false, " +
"minVersion='1.8', " +
"maxVersion='null', " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.artifactId}-${project.version}.jar</jar>
<outfile>${project.build.directory}/app.exe</outfile>
<outfileArch>WIN32</outfileArch>
<downloadUrl>https://java.com/download</downloadUrl>
<classPath>
<mainClass>pl.org.lenart.launch4j.App</mainClass>
<preCp>anything</preCp>
</classPath>
<jre>
<path>%JAVA_HOME%;%PATH%</path>
<mode>client</mode>
<minVersion>1.8</minVersion>
<bundledJreAsFallback>true</bundledJreAsFallback>
<jdkPreference>preferJre</jdkPreference>
Expand Down
Loading