Skip to content

Commit 43c2b59

Browse files
committed
Merge branch 'devel' of https://github.com/fvarrui/JavaPackager into update-why
2 parents 5874e79 + ca0644d commit 43c2b59

23 files changed

+158
-112
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add the following `plugin` tag to your `pom.xml`:
2323
<plugin>
2424
<groupId>io.github.fvarrui</groupId>
2525
<artifactId>javapackager</artifactId>
26-
<version>1.6.6-SNAPSHOT</version>
26+
<version>1.6.6</version>
2727
<executions>
2828
<execution>
2929
<phase>package</phase>
@@ -71,7 +71,7 @@ buildscript {
7171
mavenCentral()
7272
}
7373
dependencies {
74-
classpath 'io.github.fvarrui:javapackager:1.6.5'
74+
classpath 'io.github.fvarrui:javapackager:1.6.6'
7575
}
7676
}
7777
@@ -151,6 +151,7 @@ By default it will generate next artifacts in `${outputDirectory} ` folder:
151151
| `displayName` | :x: | `${project.name}` or `${name}` | App name to show. |
152152
| `envPath` | :x: | | Defines PATH environment variable in GNU/Linux and Mac OS X startup scripts. |
153153
| `extra` | :x: | | Map with extra properties to be used in customized Velocity templates, accesible through `$info.extra` variable. |
154+
| `forceInstaller` | :x: | `false` | If `true`, skips operating system check when generating installers. |
154155
| `generateInstaller` | :x: | `true` | Generates an installer for the app. |
155156
| `jdkPath` | :x: | `${java.home}` | JDK used to generate a customized JRE. It allows to bundle customized JREs for different platforms. |
156157
| `jreDirectoryName` | :x: | `"jre"` | Bundled JRE directory name. |

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dependencies {
7070
}
7171

7272
group = 'io.github.fvarrui'
73-
version = '1.6.6-SNAPSHOT'
73+
version = '1.6.6'
7474
description = 'Hybrid Maven/Gradle plugin to package Java applications as native Windows, Mac OS X or GNU/Linux executables and create installers for them'
7575

7676
sourceCompatibility = JavaVersion.VERSION_1_8

docs/windows-specific-properties.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,27 @@
7575

7676
## Exe creation properties
7777

78-
| Property | Mandatory | Default value | Description |
79-
| ------------------- | --------- | --------------------- | ---------------------------------------------------------------------- |
80-
| `headerType` | :x: | `"gui"` | EXE header type: `console` or `gui`. |
81-
| `wrapJar` | :x: | `true` | Wrap JAR file in native EXE. |
82-
| `companyName` | :x: | `${organizationName}` | EXE company name. |
83-
| `fileVersion` | :x: | `"1.0.0.0"` | EXE file version. |
84-
| `txtFileVersion` | :x: | `${version}` | EXE txt file version. |
85-
| `productVersion` | :x: | `"1.0.0.0"` | EXE product version. |
86-
| `txtProductVersion` | :x: | `${version}` | EXE txt product version. |
87-
| `fileDescription` | :x: | `${description}` | EXE file description. |
88-
| `copyright` | :x: | `${organizationName}` | EXE copyright. |
89-
| `productName` | :x: | `${name}` | EXE product name. |
90-
| `internalName` | :x: | `${name}` | EXE internal name. |
91-
| `originalFilename` | :x: | `${name}.exe` | EXE original filename. |
92-
| `trademark` | :x: | | EXE trademark. |
93-
| `language` | :x: | | EXE language. |
94-
| `exeCreationTool` | :x: | `launch4j` | EXE creation tool: `launch    4j` or `winrun4j`. |
95-
| `vmLocation` | :x: | | `jvm.dll` path relative to the bundled JRE. **Only for WinRun4J**. \*1 |
78+
| Property | Mandatory | Default value | Description |
79+
| ------------------- | --------- | --------------------- | -------------------------------------------------------------------------------------------------------------------- |
80+
| `headerType` | :x: | `"gui"` | EXE header type: `console` or `gui`. |
81+
| `wrapJar` | :x: | `true` | Wrap JAR file in native EXE. |
82+
| `companyName` | :x: | `${organizationName}` | EXE company name. |
83+
| `fileVersion` | :x: | `"1.0.0.0"` | EXE file version. |
84+
| `txtFileVersion` | :x: | `${version}` | EXE txt file version. |
85+
| `productVersion` | :x: | `"1.0.0.0"` | EXE product version. |
86+
| `txtProductVersion` | :x: | `${version}` | EXE txt product version. |
87+
| `fileDescription` | :x: | `${description}` | EXE file description. |
88+
| `copyright` | :x: | `${organizationName}` | EXE copyright. |
89+
| `productName` | :x: | `${name}` | EXE product name. |
90+
| `internalName` | :x: | `${name}` | EXE internal name. |
91+
| `originalFilename` | :x: | `${name}.exe` | EXE original filename. |
92+
| `trademark` | :x: | | EXE trademark. |
93+
| `language` | :x: | | EXE language. |
94+
| `exeCreationTool` | :x: | `launch4j` | EXE creation tool: [`launch4j`](http://launch4j.sourceforge.net/) or [`winrun4j`](http://winrun4j.sourceforge.net/). |
95+
| `vmLocation` | :x: | | `jvm.dll` path relative to the bundled JRE. **Only for WinRun4J**. \*1 |
9696

9797
> \*1: If a JRE is bundled and `vmLocation` is not specified, it uses `bin\client\jvm.dll` or `bin\server\jvm.dll` as VM location by default.
9898
99-
100-
10199
## Setup generation properties
102100

103101
| Property | Mandatory | Default value | Description |
@@ -108,7 +106,7 @@
108106
| `disableProgramGroupPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Select Start Menu Folder** wizard page. |
109107
| `disableFinishedPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Setup Completed** wizard page. |
110108
| `disableWelcomePage` | :x: | `true` | If this is set to `true`, Setup will not show **Welcome Page**. |
111-
| `createDesktopIconTask` | :x: | `true` | If this is set to `true`, Setup will not ask for **desktop icon creation**. |
109+
| `createDesktopIconTask` | :x: | `true` | If this is set to `true`, Setup will ask for **desktop icon creation**. |
112110
| `removeOldLibs` | :x: | `false` | If there's a previous installation, removes old `libs` folder before install. |
113111

114112
### SetupMode

src/main/java/io/github/fvarrui/javapackager/gradle/CreateWindowsExeLaunch4j.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@ protected File doApply(WindowsPackager packager) throws Exception {
3434
String jreDirectoryName = packager.getJreDirectoryName();
3535
String jreMinVersion = packager.getJreMinVersion();
3636
File jarFile = packager.getJarFile();
37+
File appFolder = packager.getAppFolder();
3738

3839
createAssets(packager); // creates a folder only for launch4j assets
3940

40-
String jarPath = winConfig.isWrapJar() ? getGenericJar().getAbsolutePath() : jarFile.getName();
41+
// copies JAR to app folder
42+
String jarPath;
43+
if (winConfig.isWrapJar()) {
44+
jarPath = getGenericJar().getAbsolutePath();
45+
} else {
46+
FileUtils.copyFileToFolder(jarFile, appFolder);
47+
jarPath = jarFile.getName();
48+
}
4149

4250
Launch4jLibraryTask l4jTask = Context.getGradleContext().getLibraryTask();
4351
l4jTask.getOutputs().upToDateWhen(task -> false);

src/main/java/io/github/fvarrui/javapackager/gradle/DefaultPackageTask.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ protected Packager createPackager() throws Exception {
3333
.envPath(extension.getEnvPath())
3434
.extra(extension.getExtra())
3535
.fileAssociations(extension.getFileAssociations())
36+
.forceInstaller(extension.isForceInstaller())
3637
.generateInstaller(extension.getGenerateInstaller())
3738
.jdkPath(extension.getJdkPath())
3839
.jreDirectoryName(extension.getJreDirectoryName())

src/main/java/io/github/fvarrui/javapackager/gradle/GenerateRpm.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/main/java/io/github/fvarrui/javapackager/gradle/PackagePluginExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public PackagePluginExtension(Project project) {
5151
this.winConfig = new WindowsConfig();
5252
this.outputDirectory = project.getBuildDir();
5353
this.scripts = new Scripts();
54+
this.forceInstaller = false;
5455
}
5556

5657
public LinuxConfig linuxConfig(Closure<LinuxConfig> closure) {

src/main/java/io/github/fvarrui/javapackager/gradle/PackageTask.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@ public void setGenerateInstaller(Boolean generateInstaller) {
226226
this.generateInstaller = generateInstaller;
227227
}
228228

229+
@Input
230+
@Optional
231+
private Boolean forceInstaller;
232+
233+
public Boolean isForceInstaller() {
234+
return forceInstaller;
235+
}
236+
237+
public void setForceInstaller(Boolean forceInstaller) {
238+
this.forceInstaller = forceInstaller;
239+
}
240+
229241
@InputDirectory
230242
@Optional
231243
private File jdkPath;
@@ -577,6 +589,7 @@ protected Packager createPackager() throws Exception {
577589
.envPath(defaultIfNull(envPath, extension.getEnvPath()))
578590
.extra(defaultIfNull(extra, extension.getExtra()))
579591
.fileAssociations(defaultIfNull(fileAssociations, extension.getFileAssociations()))
592+
.forceInstaller(defaultIfNull(forceInstaller, extension.isForceInstaller()))
580593
.generateInstaller(defaultIfNull(generateInstaller, extension.getGenerateInstaller()))
581594
.jdkPath(defaultIfNull(jdkPath, extension.getJdkPath()))
582595
.jreDirectoryName(defaultIfBlank(jreDirectoryName, extension.getJreDirectoryName()))

src/main/java/io/github/fvarrui/javapackager/maven/CreateWindowsExeLaunch4j.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@ protected File doApply(WindowsPackager packager) throws Exception {
4545
String classpath = packager.getClasspath();
4646
String jreMinVersion = packager.getJreMinVersion();
4747
File jarFile = packager.getJarFile();
48+
File appFolder = packager.getAppFolder();
4849

4950
createAssets(packager);
5051

51-
String jarPath = winConfig.isWrapJar() ? getGenericJar().getAbsolutePath() : jarFile.getName();
52+
// copies JAR to app folder
53+
String jarPath;
54+
if (winConfig.isWrapJar()) {
55+
jarPath = getGenericJar().getAbsolutePath();
56+
} else {
57+
FileUtils.copyFileToFolder(jarFile, appFolder);
58+
jarPath = jarFile.getName();
59+
}
5260

5361
List<Element> optsElements = vmArgs.stream().map(arg -> element("opt", arg)).collect(Collectors.toList());
5462

src/main/java/io/github/fvarrui/javapackager/maven/PackageMojo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ public class PackageMojo extends AbstractMojo {
7272
@Parameter(defaultValue = "true", property = "generateInstaller", required = false)
7373
private Boolean generateInstaller;
7474

75+
/**
76+
* Forces installer generation.
77+
*/
78+
@Parameter(defaultValue = "false", property = "forceInstaller", required = false)
79+
private Boolean forceInstaller;
80+
7581
/**
7682
* Full path to your app main class.
7783
*/
@@ -339,6 +345,7 @@ public void execute() throws MojoExecutionException {
339345
.envPath(envPath)
340346
.extra(extra)
341347
.fileAssociations(fileAssociations)
348+
.forceInstaller(forceInstaller)
342349
.generateInstaller(generateInstaller)
343350
.iconFile(iconFile)
344351
.jdkPath(jdkPath)

0 commit comments

Comments
 (0)