Skip to content

Commit 558a0ac

Browse files
committed
U docs
1 parent ffaa18e commit 558a0ac

File tree

2 files changed

+76
-24
lines changed

2 files changed

+76
-24
lines changed

README.md

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.fvarrui/javapackager/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.fvarrui/javapackager)
44

5-
JavaPackager is a Maven plugin which provides an easy way to package Java applications in native Windows, Mac OS X, or GNU/Linux executables, and generates installers for them.
5+
JavaPackager is a hybrid plugin for **Maven** and **Gradle** which provides an easy way to package Java applications in native Windows, Mac OS X or GNU/Linux executables, and generates installers for them.
66

77
> SNAPSHOT versions are not released to Maven Central, so you have to [install them manually](#how-to-build-and-install-the-plugin).
88
99
## How to use this plugin
1010

11-
### Config your project
11+
### Config your project and package your app with Maven
1212

1313
Add the following `plugin` tag to your `pom.xml`:
1414

1515
```xml
1616
<plugin>
1717
<groupId>io.github.fvarrui</groupId>
1818
<artifactId>javapackager</artifactId>
19-
<version>1.1.0|1.2.0-SNAPSHOT</version>
19+
<version>1.2.0|1.2.1-SNAPSHOT</version>
2020
<executions>
2121
<execution>
2222
<phase>package</phase>
@@ -46,17 +46,67 @@ Add the following `plugin` tag to your `pom.xml`:
4646
</plugin>
4747
```
4848

49-
> See [plugin configuration samples](docs/plugin-configuration-samples.md) to know more.
49+
> See [Maven plugin configuration samples](docs/maven-plugin-configuration-samples.md) to know more.
5050
51-
### Package your app
52-
53-
Execute the next command in project's root folder:
51+
And execute the next command in project's root folder:
5452

5553
```bash
5654
mvn package
5755
```
5856

59-
And by default it will generate next artifacts in `target ` folder:
57+
### Config your project and package your app with Gradle
58+
59+
Apply JavaPackager plugin in `build.gradle` in legacy mode, :
60+
61+
```groovy
62+
buildscript {
63+
repositories {
64+
mavenCentral()
65+
}
66+
dependencies {
67+
classpath 'io.github.fvarrui:javapackager:1.2.0'
68+
}
69+
}
70+
71+
apply plugin: 'io.github.fvarrui.javapackager.plugin'
72+
```
73+
74+
Create your packaging task:
75+
76+
```groovy
77+
task packageMyApp(type: io.github.fvarrui.javapackager.gradle.PackageTask, dependsOn: build) {
78+
// mandatory
79+
mainClass = 'path.to.your.mainClass'
80+
// optional
81+
bundleJre = true|false
82+
generateInstaller = true|false
83+
administratorRequired = true|false
84+
platform = auto|linux|mac|windows
85+
additionalResources = [ file('file path'), file('folder path'), ... ]
86+
linuxConfig {
87+
...
88+
}
89+
macConfig {
90+
...
91+
}
92+
winConfig {
93+
...
94+
}
95+
...
96+
}
97+
```
98+
99+
> See [Gradle plugin configuration samples](docs/gradle-plugin-configuration-samples.md) to know more.
100+
101+
And execute the next command in project's root folder:
102+
103+
```bash
104+
gradle packageMyApp
105+
```
106+
107+
### Generated artifacts
108+
109+
By default it will generate next artifacts in `target ` folder:
60110

61111
| Artifact | Description |
62112
| --------------------------------------- | ------------------------------------------------------------ |
@@ -69,7 +119,6 @@ And by default it will generate next artifacts in `target ` folder:
69119
| `${name}_${version}.dmg` | Disk image file if it's executed on Mac OS X (requires **hdiutil**). |
70120
| `${name}_${version}.pkg` | PKG installer file if it's executed on Mac OS X (requires **pkgbuild**) |
71121
| `${name}-${version}-${platform}.zip` | Zipball containing generated directory `${name}`. |
72-
| `${name}-${version}-${platform}.tar` | Tarball containing generated directory `${name}`. |
73122
| `${name}-${version}-${platform}.tar.gz` | Compressed tarball containing generated directory `${name}`. |
74123

75124
> :warning: Installers generation will be ommited if target platform is different from current platform (see `platform` property).
@@ -81,7 +130,7 @@ And by default it will generate next artifacts in `target ` folder:
81130
| `additionalModules` | :x: | `[]` | Additional modules to the ones identified by `jdeps` or the specified with `modules` property. |
82131
| `additionalResources` | :x: | `[]` | Additional files and folders to include in the bundled app. |
83132
| `administratorRequired` | :x: | `false` | App will run as administrator (with elevated privileges). |
84-
| `assetsDir` | :x: | `${basedir}/assets` | Assets location (icons and custom Velocity templates). |
133+
| `assetsDir` | :x: | `${basedir}/assets` or `${projectdir}/assets` | Assets location (icons and custom Velocity templates). |
85134
| `bundleJre` | :x: | `false` | Embeds a customized JRE with the app. |
86135
| `copyDependencies` | :x: | `true` | Bundles all dependencies (JAR files) with the app. |
87136
| `createTarball` | :x: | `false` | Bundles app folder in tarball. |
@@ -96,7 +145,7 @@ And by default it will generate next artifacts in `target ` folder:
96145
| `jdkPath` | :x: | `${java.home}` | JDK used to generate a customized JRE. It allows to bundle customized JREs for different platforms. |
97146
| `jreDirectoryName` | :x: | `"jre"` | Bundled JRE directory name. |
98147
| `jrePath` | :x: | `""` | Path to JRE folder. If specified, it will bundle this JRE with the app, and won't generate a customized JRE. For Java 8 version or least. |
99-
| `licenseFile` | :x: | `${project.licenses[0].url}` or `${project.basedir}/LICENSE` | Path to project license file. |
148+
| `licenseFile` | :x: | `${project.licenses[0].url}` or `${basedir}/LICENSE` or `${projectdir}/LICENSE` | Path to project license file. |
100149
| `mainClass` | :heavy_check_mark: | `${exec.mainClass}` | Full path to your app main class. |
101150
| `modules` | :x: | `[]` | Defines modules to customize the bundled JRE. Don't use `jdeps` to get module dependencies. |
102151
| `name` | :x: | `${project.name}` or `${project.artifactId}` | App name. |
@@ -160,18 +209,20 @@ It is possible to use your own customized templates. You just have to put one of
160209
```
161210
${assetsDir}/
162211
├── linux/
163-
| ├── control.vtl # DEB control template
164-
| ├── desktop.vtl # Desktop template
165-
│   └── startup.sh.vtl # Startup script template
212+
| ├── assembly.xml.vtl # maven-assembly-plugin template to generate ZIP/TGZ bundles for GNU/Linux
213+
| ├── control.vtl # DEB control template
214+
| ├── desktop.vtl # Desktop template
215+
│   └── startup.sh.vtl # Startup script template
166216
├── mac/
167-
| ├── customize-dmg.applescript.vtl # DMG customization Applescript template
168-
| ├── Info.plist.vtl # Info.plist template
169-
│   └── startup.vtl # Startup script template
170-
├── windows/
171-
| ├── exe.manifest.vtl # exe.manifest template
172-
| ├── iss.vtl # Inno Setup Script template
173-
│   └── wxs.vtl # WiX Toolset WXS template
174-
└── assembly.xml.vtl # maven-assembly-plugin template used to generate ZIP/TGZ bundles
217+
| ├── assembly.xml.vtl # maven-assembly-plugin template to generate ZIP/TGZ bundles for Mac OS X
218+
| ├── customize-dmg.applescript.vtl # DMG customization Applescript template
219+
| ├── Info.plist.vtl # Info.plist template
220+
│   └── startup.vtl # Startup script template
221+
└── windows/
222+
├── assembly.xml.vtl # maven-assembly-plugin template to generate ZIP/TGZ bundles for Windows
223+
├── exe.manifest.vtl # exe.manifest template
224+
├── iss.vtl # Inno Setup Script template
225+
   └── wxs.vtl # WiX Toolset WXS template
175226
```
176227

177228
> Use [default templates](https://github.com/fvarrui/JavaPackager/tree/master/src/main/resources) as examples.
@@ -194,15 +245,15 @@ cd JavaPackager
194245
2. Compile, package and install the plugin in your local repository (ommit `./` on Windows):
195246

196247
```bash
197-
./gradlew clean build publishToMavenLocal
248+
./gradlew publishToMavenLocal
198249
```
199250

200251
## How to release the plugin to Maven Central
201252

202253
Run next command after [build and publish the plugin locally](#how-to-build-and-install-the-plugin) (ommit `./` on Windows):
203254

204255
```bash
205-
./gradlew -Prelease uploadArchives closeAndPromoteRepository
256+
./gradlew -Prelease uploadArchives closeAndReleaseRepository
206257
```
207258

208259
> Related [guide](https://nemerosa.ghost.io/2015/07/01/publishing-to-the-maven-central-using-gradle/).
@@ -213,6 +264,7 @@ Check the [TO-DO list](https://github.com/fvarrui/JavaPackager/projects/1#column
213264

214265
## Older documentation
215266

267+
- [v1.1.0](https://github.com/fvarrui/JavaPackager/blob/v1.1.0/README.md)
216268
- [v1.0.3](https://github.com/fvarrui/JavaPackager/blob/v1.0.3/README.md)
217269
- [v1.0.2](https://github.com/fvarrui/JavaPackager/blob/v1.0.2/README.md)
218270
- [v1.0.1](https://github.com/fvarrui/JavaPackager/blob/v1.0.1/README.md)
File renamed without changes.

0 commit comments

Comments
 (0)