Adding information for pushing to Maven Central as well as using the api.

This commit is contained in:
Rob Greene 2018-05-26 18:07:56 -05:00
parent 9b8429b211
commit d488113b84
3 changed files with 140 additions and 0 deletions

59
api/MAVEN-REPO.md Normal file
View File

@ -0,0 +1,59 @@
# 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
> Note that all of this can be run from the main 'applesingle' folder.
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

@ -2,6 +2,28 @@
Usage is catered to the factory methods and builder. Some sample are included below.
## Maven / Gradle
To include in a Maven project:
```xml
<dependency>
<groupId>net.sf.applecommander</groupId>
<artifactId>applesingle</artifactId>
<version>1.0.0</version>
</dependency>
```
To include in a Gradle project:
```groovy
dependencies {
// ...
compile "net.sf.applecommander:applesingle:1.0.0"
// ...
}
```
## Read AppleSingle
Use the factory method to...

View File

@ -9,3 +9,62 @@ apply plugin: 'signing'
dependencies {
testImplementation 'junit:junit:4.12'
}
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: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
}
pom.project {
name archivesBaseName
packaging 'jar'
description 'A Java library for managing AppleSingle files.'
url 'https://applecommander.github.io/'
scm {
url 'https://github.com/AppleCommander/applesingle'
}
licenses {
license {
name 'The GNU General Public License (GPL) Version 3, 29 June 2007'
url 'https://www.gnu.org/licenses/gpl-3.0.html'
}
}
developers {
developer {
id 'robgreene'
email 'robgreene@gmail.com'
}
}
}
}
}
}