Re-introducing the publish to maven capability.

This commit is contained in:
Rob Greene 2021-12-21 19:36:51 -06:00
parent 7d4aa1a4c6
commit 5fbaa95ed0
11 changed files with 94 additions and 15 deletions

View File

@ -24,24 +24,35 @@ Extract secret key for the Gradle signing plugin:
$ gpg2 --export-secret-keys > secring.gpg $ gpg2 --export-secret-keys > secring.gpg
``` ```
## Build and publish to Central Repository ## Gradle build and publish to Central Repository
> NOTE: The build has been updated to allow snapshots to be published. These appear to be automatically available.
Ensure full build passes: Ensure full build passes:
```bash ```bash
$ ./gradlew clean test javadoc assemble ./gradlew clean build
<...lots of stuff, primarily Javadoc issues...>
BUILD SUCCESSFUL in 3s BUILD SUCCESSFUL in 8s
13 actionable tasks: 13 executed 91 actionable tasks: 91 executed
``` ```
Upload: Publish:
```bash ```bash
$ ./gradlew uploadArchives $ ./gradlew publish
BUILD SUCCESSFUL in 10s BUILD SUCCESSFUL in 8s
10 actionable tasks: 1 executed, 9 up-to-date 2 actionable tasks: 2 executed
```
The can also be combined:
```bash
$ ./gradlew clean build publish
BUILD SUCCESSFUL in 16s
93 actionable tasks: 93 executed
``` ```
Then follow "releasing the deployment" below. Then follow "releasing the deployment" below.
@ -52,6 +63,7 @@ Just a reminder!
# References # References
* http://central.sonatype.org/pages/gradle.html * http://central.sonatype.org/pages/gradle.html (NOTE: Documentation is out of date)
* http://central.sonatype.org/pages/releasing-the-deployment.html * http://central.sonatype.org/pages/releasing-the-deployment.html
* https://docs.gradle.org/current/userguide/publishing_maven.html
* For all the other little pieces, Google is your friend. ;-) * For all the other little pieces, Google is your friend. ;-)

View File

@ -23,6 +23,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'ac'
manifest { manifest {
attributes 'Implementation-Title': "AppleCommander 'ac'", attributes 'Implementation-Title': "AppleCommander 'ac'",
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -16,6 +16,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'swing-ui'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Swing)', attributes 'Implementation-Title': 'AppleCommander (Swing)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -20,6 +20,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'linux-aarch64'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Linux Arm)', attributes 'Implementation-Title': 'AppleCommander (Linux Arm)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -20,6 +20,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'linux-x86_64'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Linux)', attributes 'Implementation-Title': 'AppleCommander (Linux)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -20,6 +20,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'macosx-aarch64'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Mac Arm)', attributes 'Implementation-Title': 'AppleCommander (Mac Arm)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -20,6 +20,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'macosx-x86_64'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Mac)', attributes 'Implementation-Title': 'AppleCommander (Mac)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -20,6 +20,8 @@ application {
} }
bootJar { bootJar {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'win32-x86_64'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander (Windows)', attributes 'Implementation-Title': 'AppleCommander (Windows)',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion

View File

@ -1,7 +1,7 @@
# Universal AppleCommander version number. Used for: # Universal AppleCommander version number. Used for:
# - Naming JAR file. # - Naming JAR file.
# - The build will insert this into a file that is read at run time as well. # - The build will insert this into a file that is read at run time as well.
version=1.7.0pre version=1.7.0-SNAPSHOT
# Dependency versions # Dependency versions
shkVersion=1.2.2 shkVersion=1.2.2
@ -13,7 +13,3 @@ antVersion=1.8.2
commonsLang3Version=3.7 commonsLang3Version=3.7
commonsCsvVersion=1.8 commonsCsvVersion=1.8
gsonVersion=2.8.6 gsonVersion=2.8.6
# Maven Central Repository G and A of GAV coordinate. :-)
group=net.sf.applecommander
archivesBaseName=AppleCommander

View File

@ -1,5 +1,7 @@
plugins { plugins {
id 'java-library' id 'java-library'
id 'maven-publish'
id 'signing'
} }
repositories { repositories {
@ -15,6 +17,8 @@ dependencies {
} }
tasks.withType(Jar) { tasks.withType(Jar) {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'api'
manifest { manifest {
attributes 'Implementation-Title': 'AppleCommander', attributes 'Implementation-Title': 'AppleCommander',
'Implementation-Version': archiveVersion 'Implementation-Version': archiveVersion
@ -32,3 +36,51 @@ java {
withSourcesJar() withSourcesJar()
withJavadocJar() withJavadocJar()
} }
signing {
sign configurations.archives
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = "net.sf.applecommander"
artifactId = "AppleCommander"
name = 'AppleCommander'
description = 'AppleCommander is a general utility for Apple II disk images.'
url = 'https://applecommander.github.io/'
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'
name = 'Rob Greene'
email = 'robgreene@gmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/AppleCommander/AppleCommander.git'
developerConnection = 'scm:git:git@github.com:AppleCommander/AppleCommander.git'
url = 'https://github.com/AppleCommander/AppleCommander'
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
}
}
}

View File

@ -41,3 +41,8 @@ test {
} }
} }
} }
tasks.withType(Jar) {
archiveBaseName = 'AppleCommander'
archiveAppendix = 'swt-common'
}