To make sure everything works:
./gradlew clean build check
To format everything using Spotless:
./gradlew spotlessApply
First, try publishing to maven local:
./gradlew publishToMavenLocal
If that works, then publish to Sonatype's staging repository and close:
./gradlew publishToSonatype closeSonatypeStagingRepository
Inspect this in Sonatype OHSSH repository. Delete the staging repository after inspection.
And then to promote it:
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
If it looks weird that you have to specify "publishToSonatype" with another task, that's because it is weird.
If you run into errors with signing doing a publishToSonaType
, this is common and underdocumented.
No value has been specified for property 'signatory.keyId'.
For the signatory.keyId
error message, you need to set signing.gnupg.keyName
if you
are using GPG 2.1 and a Yubikey 4.
https://docs.gradle.org/current/userguide/signing_plugin.html#sec:signatory_credentials https://github.com/gradle/gradle/pull/1703/files#diff-6c52391bbdceb4cca64ce7b03e78212fR6
Note you need to use gpg -K
and pick only the LAST EIGHT CHARS of the public signing key.
signing.gnupg.keyName = 5F798D53
Also note that if you are using a Yubikey, it'll require you to type in a PIN, which screws up Gradle.
gpg: signing failed: No pinentry
So you need to use pinentry-mode loopback, which is helpfully supplied by passphrase.
- sbt/sbt-pgp#142
- https://wiki.archlinux.org/index.php/GnuPG#Unattended_passphrase
- https://github.com/gradle/gradle/pull/1703/files#diff-790036df959521791fdafe474b673924
You want this specified only the command line, i.e.
$ HISTCONTROL=ignoreboth ./gradlew publishToMavenLocal -Psigning.gnupg.passphrase=$PGP_PASSPHRASE --info
gpg can't be run in parallel. You'll get this error message.
gpg: signing failed: Cannot allocate memory
Gradle is not smart enough to disable this.
Do not use -Porg.gradle.parallel=false
and don't use --parallel
when publishing.
If you deploy snapshots to sonatype, you don't get the jar files.
No idea why this happens, but for now only use staging without the -SNAPSHOT prefix.