Skip to content

Commit fe278a1

Browse files
committed
Merge branch 'devel'
2 parents eaf3681 + 30f993f commit fe278a1

File tree

12 files changed

+336
-184
lines changed

12 files changed

+336
-184
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JavaPackager
22

3-
[![Maven Central](http://img.shields.io/maven-central/v/io.github.fvarrui/javapackager)](https://central.sonatype.com/artifact/io.github.fvarrui/javapackager/1.7.0)
3+
[![Maven Central](http://img.shields.io/maven-central/v/io.github.fvarrui/javapackager)](https://central.sonatype.com/artifact/io.github.fvarrui/javapackager/1.7.1)
44
[![GPL-3.0](https://img.shields.io/badge/license-GPL--3.0-%250778B9.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
55

66
JavaPackager is a hybrid plugin for **Maven** and **Gradle** which provides an easy way to package Java applications in native Windows, MacOS or GNU/Linux executables, and generate installers for them.
@@ -309,7 +309,7 @@ cd JavaPackager
309309
Run next command (ommit `./` on Windows):
310310

311311
```bash
312-
./gradlew -Prelease uploadArchives closeAndReleaseRepository
312+
./gradlew publish closeAndReleaseRepository
313313
```
314314

315315
> Related [guide](https://nemerosa.ghost.io/2015/07/01/publishing-to-the-maven-central-using-gradle/).

build.gradle

Lines changed: 77 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
plugins {
22
id 'java'
3-
id 'maven'
43
id 'maven-publish'
54
id 'java-gradle-plugin'
6-
id 'com.gradle.plugin-publish' version '0.12.0'
5+
id 'com.gradle.plugin-publish' version '1.1.0'
76
id 'io.codearte.nexus-staging' version '0.21.2'
87
id 'eclipse'
98
id 'de.undercouch.download' version '5.0.4'
9+
id 'signing'
1010
}
1111

1212
repositories {
@@ -17,27 +17,6 @@ repositories {
1717
}
1818
}
1919

20-
gradlePlugin {
21-
plugins {
22-
javaPackagerPlugin {
23-
id = 'io.github.fvarrui.javapackager.plugin'
24-
implementationClass = 'io.github.fvarrui.javapackager.gradle.PackagePlugin'
25-
}
26-
}
27-
}
28-
29-
pluginBundle {
30-
website = 'http://github.com/fvarrui/JavaPackager'
31-
vcsUrl = 'http://github.com/fvarrui/JavaPackager.git'
32-
description = 'Packages Java applications as native Windows, MacOS or GNU/Linux executables and creates installers for them'
33-
tags = ['java', 'packager', 'gradle-plugin', 'maven-plugin', 'native', 'installer', 'debian-packages', 'rpm-packages', 'dmg', 'maven', 'gradle', 'distribution', 'javapackager', 'linux-executables', 'deb', 'rpm', 'native-windows', 'java-applications', 'pkg', 'msi']
34-
plugins {
35-
javaPackagerPlugin {
36-
displayName = 'JavaPackager'
37-
}
38-
}
39-
}
40-
4120
configurations {
4221
mavenEmbedder
4322
}
@@ -70,166 +49,125 @@ dependencies {
7049
}
7150

7251
group = 'io.github.fvarrui'
73-
version = '1.7.0'
52+
version = '1.7.1'
7453
description = 'Hybrid Maven/Gradle plugin to package Java applications as native Windows, Mac OS X or GNU/Linux executables and create installers for them'
7554

7655
sourceCompatibility = JavaVersion.VERSION_1_8
7756
targetCompatibility = JavaVersion.VERSION_1_8
7857

7958
compileJava.options.encoding = 'UTF-8'
8059

81-
publishing {
82-
publications {
83-
mavenJava(MavenPublication) {
84-
from(components.java)
85-
}
86-
}
87-
}
88-
8960
java {
9061
withSourcesJar()
91-
// and/or analogously use "withJavadocJar()" to get a "javadocJar" task
92-
}
93-
94-
install.repositories.mavenInstaller.pom.with {
95-
groupId = project.group
96-
artifactId = project.name
97-
version = project.version
98-
description = project.description
99-
packaging = 'maven-plugin'
62+
withJavadocJar()
10063
}
10164

10265
build.dependsOn ':winrun4j-launcher:build'
10366

67+
// OSSRH publication
68+
publishing {
69+
repositories {
70+
maven {
71+
name = "OSSRH"
72+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
73+
credentials {
74+
username = project.findProperty("ossrhUser") ?: ''
75+
password = project.findProperty("ossrhPassword") ?: ''
76+
}
77+
}
78+
}
79+
publications {
80+
pluginMaven(MavenPublication) {
81+
def directory = buildDir.canonicalPath
82+
def outputDirectory = compileJava.destinationDirectory.asFile.get().canonicalPath
83+
pom.withXml {
84+
asNode().appendNode('build')
85+
.with {
86+
appendNode('directory', directory)
87+
appendNode('outputDirectory', outputDirectory)
88+
}
89+
asNode().appendNode('repositories').appendNode('repository')
90+
.with {
91+
appendNode('id', 'gradle')
92+
appendNode('name', 'Gradle Plugin Portal')
93+
appendNode('url', 'https://plugins.gradle.org/m2/')
94+
}
95+
}
96+
pom {
97+
name = project.name
98+
groupId = project.group
99+
artifactId = project.name
100+
version = project.version
101+
description = project.description
102+
packaging = 'maven-plugin'
103+
url = 'https://github.com/fvarrui/JavaPackager'
104+
scm {
105+
connection = 'scm:git:git://github.com/fvarrui/JavaPackager.git'
106+
developerConnection = 'scm:git:git@github.com:fvarrui/fvarrui.git'
107+
url = 'https://github.com/fvarrui/JavaPackager'
108+
}
109+
licenses {
110+
license {
111+
name = 'GPL-v3.0'
112+
url = 'http://www.gnu.org/licenses/gpl-3.0.txt'
113+
distribution = 'repo'
114+
}
115+
}
116+
developers {
117+
developer {
118+
id = 'fvarrui'
119+
name = 'Francisco Vargas Ruiz'
120+
url = 'https://github.com/fvarrui'
121+
}
122+
}
123+
}
124+
}
125+
}
126+
}
127+
104128
// runs the plugin description generator
105129
task generatePluginDescriptor(type: JavaExec, dependsOn: compileJava) {
106-
107-
def pomFile = file("$buildDir/pom.xml")
108-
def pluginDescriptorFile = new File(project.compileJava.destinationDir, 'META-INF/maven/plugin.xml')
109-
def directory = buildDir.canonicalPath
110-
def outputDirectory = compileJava.destinationDir.canonicalPath
130+
def pluginDescriptorFile = new File(project.compileJava.destinationDirectory.asFile.get(), 'META-INF/maven/plugin.xml')
111131

112132
// FIXME: this does not seem to be working
113133
inputs.files project.compileJava.outputs.files
114134
outputs.file pluginDescriptorFile
115135

116136
classpath = configurations.mavenEmbedder
117-
main = 'org.apache.maven.cli.MavenCli'
137+
mainClass = 'org.apache.maven.cli.MavenCli'
118138
systemProperties['maven.multiModuleProjectDirectory'] = projectDir
119139
args = [
120140
'--errors',
121141
'--batch-mode',
122-
'--file', "${buildDir}/pom.xml",
142+
'--file', generatePomFileForPluginMavenPublication.destination,
123143
'org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor',
124144
'-Dproject.build.sourceEncoding=' + compileJava.options.encoding
125145
]
126-
127-
doFirst {
128-
install.repositories
129-
.mavenInstaller
130-
.pom
131-
.withXml {
132-
asNode().appendNode('repositories').appendNode('repository')
133-
.with {
134-
appendNode('id', 'gradle')
135-
appendNode('name', 'Gradle Plugin Portal')
136-
appendNode('url', 'https://plugins.gradle.org/m2/')
137-
}
138-
asNode().appendNode('build')
139-
.with {
140-
appendNode('directory', directory)
141-
appendNode('outputDirectory', outputDirectory)
142-
}
143-
}
144-
.writeTo(pomFile)
145-
146-
assert pomFile.file, "${pomFile.canonicalPath}: was not generated"
147-
logger.info("POM is generated in ${pomFile.canonicalPath}")
148-
}
149-
150146
doLast {
151147
assert pluginDescriptorFile.file, "${pluginDescriptorFile.canonicalPath}: was not generated"
152148
logger.info("Plugin descriptor is generated in ${pluginDescriptorFile.canonicalPath}")
153149
}
154150
}
151+
generatePluginDescriptor.dependsOn(generatePomFileForPluginMavenPublication)
155152

156-
project.jar.dependsOn(generatePluginDescriptor)
153+
project.classes.dependsOn(generatePluginDescriptor)
154+
project.validatePlugins.dependsOn(generatePluginDescriptor)
157155
publishToMavenLocal.dependsOn(build)
158-
159-
if (project.hasProperty('release')) {
160156

161-
apply plugin: 'signing'
162-
apply plugin: 'maven'
163-
164-
task deployingJavadocJar(type: Jar) {
165-
classifier = 'javadoc'
166-
from javadoc
167-
}
168-
169-
task deployingSourcesJar(type: Jar) {
170-
classifier = 'sources'
171-
from sourceSets.main.allSource
157+
// Signature of publication
158+
signing {
159+
setRequired {
160+
// signing is only required if the artifacts are to be published
161+
gradle.taskGraph.allTasks.any { it instanceof PublishToMavenRepository }
172162
}
173-
174-
artifacts {
175-
archives deployingJavadocJar, deployingSourcesJar
176-
}
177-
178-
// Signature of artifacts
179-
signing {
180-
sign configurations.archives
181-
}
182-
183-
// OSSRH publication
184-
uploadArchives {
185-
repositories {
186-
mavenDeployer {
187-
// POM signature
188-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
189-
// Target repository
190-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
191-
authentication(userName: ossrhUser, password: ossrhPassword)
192-
}
193-
pom.project {
194-
name project.name
195-
description project.description
196-
packaging = 'maven-plugin'
197-
url 'https://github.com/fvarrui/JavaPackager'
198-
199-
scm {
200-
connection 'scm:git:git://github.com/fvarrui/JavaPackager.git'
201-
developerConnection 'scm:git:git@github.com:fvarrui/fvarrui.git'
202-
url 'https://github.com/fvarrui/JavaPackager'
203-
}
204-
205-
licenses {
206-
license {
207-
name 'GPL-v3.0'
208-
url 'http://www.gnu.org/licenses/gpl-3.0.txt'
209-
distribution 'repo'
210-
}
211-
}
212-
213-
developers {
214-
developer {
215-
id = 'fvarrui'
216-
name = 'Francisco Vargas Ruiz'
217-
url = 'https://github.com/fvarrui'
218-
}
219-
}
220-
}
221-
}
222-
}
223-
}
224-
163+
sign publishing.publications.pluginMaven
225164
}
226165

227166
nexusStaging {
228167
username = project.findProperty('ossrhUser') ?: ''
229168
password = project.findProperty('ossrhPassword') ?: ''
230169
}
231170

232-
233171
task updateUniversalJavaApplicationStub(type : Download) {
234172
def version = '20220410.162252'
235173
group 'Update assets'

docs/macosx-specific-properties.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<entitlements>path/to/entitlements.plist</entitlements>
1717
<codesignApp>true|false</codesignApp>
1818
<hardenedCodesign>true|false</hardenedCodesign>
19+
<notarizeApp>true|false</notarizeApp>
20+
<keyChainProfile>xcrun_notarytool_profile_name</keyChainProfile>
1921

2022
<!-- properties used for DMG disk image generation -->
2123
<backgroundImage>path/to/png</backgroundImage>
@@ -62,11 +64,13 @@
6264
## Signing properties
6365

6466
| Property | Mandatory | Default value | Description |
65-
| ------------------ | --------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
67+
|--------------------| --------- |---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
6668
| `developerId` | :x: | | Signing identity. |
6769
| `entitlements` | :x: | | Path to [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements) file. |
6870
| `codesignApp` | :x: | `true` | If it is set to `false`, generated app will not be codesigned. |
6971
| `hardenedCodesign` | :x: | `true` | If it is set to `true`, enable [hardened runtime](https://developer.apple.com/documentation/security/hardened_runtime) if MacOS version >= 10.13.6. |
72+
| `notarizeApp` | :x: | `false` | If it is set to `true`, generated app will be submitted to apple for notarization and the ticket will be stapled. |
73+
| `keyChainProfile` | :x: | | Profile name originally provided to `xcrun notarytool store-credentials`. Must be set if `notarizeApp` is `true`.
7074
| `macStartup` | :x: | `SCRIPT` | App startup type, using a `SCRIPT` or a binary (compiled version of the script: `UNIVERSAL`, `X86_64` or `ARM64`). |
7175

7276
## DMG generation properties

docs/windows-specific-properties.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<generateMsm>true|false</generateMsm>
1111

1212
<!-- exe creation properties -->
13-
<headerType>gui</headerType>
13+
<headerType>gui|console</headerType>
1414
<wrapJar>true|false</wrapJar>
1515
<companyName>${organizationName}</companyName>
1616
<fileVersion>1.0.0.0</fileVersion>
@@ -55,10 +55,10 @@
5555
<registry>
5656
<entries>
5757
<entry>
58-
<key>root:path/to/my/key</key>
59-
<valueName>name</valueName>
60-
<valueType>type</valueType>
61-
<valueData>data</valueData>
58+
<key>root:path/to/my/key</key>
59+
<valueName>name</valueName>
60+
<valueType>type</valueType>
61+
<valueData>data</valueData>
6262
</entry>
6363
[...]
6464
</entries>

docs/windows-tools-guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Windows tools installation guide
22

3-
As explained in the [docs](https://github.com/fvarrui/JavaPackager#generated-artifacts), you must install [Inno Setup (iscc)](https://jrsoftware.org/isinfo.php) to generate an EXE installer and [WIX Toolset (candle and light)](https://wixtoolset.org/) to generate a MSI file.
3+
As explained in the [docs](https://github.com/fvarrui/JavaPackager#generated-artifacts), you must install [Inno Setup (iscc)](https://jrsoftware.org/isinfo.php) to generate an EXE installer and [WIX Toolset (candle and light)](https://wixtoolset.org/) to generate an MSI file.
4+
5+
For Inno Setup 5.x, the Unicode version should be used, because the scripts that JavaPacker will be creating as an input will be UTF-8 encoded.
46

57
## Using Chocolatey
68
You can install both tools in a simple way using [Chocolatey](https://chocolatey.org/) package manager:
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
54
zipStoreBase=GRADLE_USER_HOME
6-
zipStorePath=wrapper/dists
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)