Adding Gradle config to publish to the Maven Central Repository.

This commit is contained in:
Rob Greene 2018-03-07 19:59:46 -06:00
parent 1bd7b5f431
commit 3b28ad7a07
5 changed files with 130 additions and 0 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ build/
.settings/
.classpath
.project
bin/

57
MAVEN-REPO.md Normal file
View File

@ -0,0 +1,57 @@
# Releasing to the Maven Central Repository
## GPG Keys
Summary of commands for GPG2 keys preparation...
Generate key:
```bash
$ gpg2 --gen-key
```
Publish key on public key server:
```bash
$ gpg2 --list-keys
$ gpg2 --list-secret-keys
$ gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys <key-id>
```
Extract secret key for the Gradle signing plugin:
```bash
$ gpg2 --export-secret-keys > secring.gpg
```
## Build and publish to Central Repository
Ensure full build passes:
```bash
$ ./gradlew clean test javadoc assemble
<...lots of stuff, primarily Javadoc issues...>
BUILD SUCCESSFUL in 3s
13 actionable tasks: 13 executed
```
Upload:
```bash
$ ./gradlew uploadArchives
BUILD SUCCESSFUL in 10s
10 actionable tasks: 1 executed, 9 up-to-date
```
Then follow "releasing the deployment" below.
## Tag and publish on GitHub
Just a reminder!
# References
* http://central.sonatype.org/pages/gradle.html
* http://central.sonatype.org/pages/releasing-the-deployment.html
* For all the other little pieces, Google is your friend. ;-)

View File

@ -3,3 +3,6 @@
This project is a direct off-shoot of the AppleCommander project and implements a pure Java API to manipulate ShrinkIt (NuFX)
archives ([Apple File Type Note $E0/8002](http://www.apple2online.com/web_documents/ft_e0.8002_shrinkit.pdf)).
*Developers*
Being new to Gradle, all of the Maven release components are in the `build.gradle` file. More a warning than anything, just in case it causes issues. Please make more portable and submit a PR.

View File

@ -1,5 +1,7 @@
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
jcenter()
@ -18,3 +20,62 @@ jar {
)
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name archivesBaseName
packaging 'jar'
description 'A Java library for managing Apple II ShrinkIt archives.'
url 'https://applecommander.github.io/'
scm {
url 'https://github.com/AppleCommander/ShrinkItArchive'
}
licenses {
license {
name 'The GNU General Public License (GPL) Version 2, June 1991'
url 'https://www.gnu.org/licenses/gpl-2.0.html'
}
}
developers {
developer {
id 'robgreene'
email 'robgreene@gmail.com'
}
}
}
}
}
}

8
gradle.properties Normal file
View File

@ -0,0 +1,8 @@
# Universal ShrinkItArchive version number. Used for:
# - Naming JAR file.
# - The build will insert this into a file that is read at run time as well.
version=1.1.0
# Maven Central Repository G and A of GAV coordinate. :-)
group=net.sf.applecommander
archivesBaseName=AppleCommander