This section covers how to publish the repository artifacts to Maven Central Repository, under the group id stellar-anchor-sdk
.
Before the publication can be published, it must be signed using a GPG key.
If you don't have a GPG key, you need to generate the pair by running
> gpg2 --full-generate-key
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
(14) Existing key from card
Your Selection: 4
Select 4
to generate a sign-only RSA key pair and enter 4096
to create a 4096-bit RSA keys. Follow the prompt the finish.
To list all keys, run:
gpg2 --list-keys
To list all keys in short format, run:
gpg2 --list-keys --keyid-format short
Now export the secret key in keyring format:
gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
Now, we need to tell Gradle to use the new key for signing. In ~/.gradle/gradle.properties
, add/modify the
following entries:
signing.keyId=${short-key-id}
signing.password=${key-password}
signing.secretKeyRingFile=${HOME_DIR}/.gnupg/secring.gpg
Here are the steps to publishing the Stellar Anchor Java SDK to Maven Central:
- Set the environment varibles:
OSSRH_USER=[OSSRH username]
andOSSRH_PASSWORD=[OSSRH password]
. - Run
./gradlew publish
. Thepublish
task will sign all publications with thesign
plug-in configured by~/.gradle/gradle.properties
. - If
publish
task is executed successfully, we should see the repository successfully published. Open the OSSRH Console to manage the publication. - Under
Staging Repositories
, select the published repository. - Click on
Drop
to delete the publication, if that's what you want. - Click on
Close
to trigger the Maven Central validation process. The sync process of the artifactory to Maven Central is enabled by OSSRH-78005 ticket.
The repository should be searchable at: Maven Search. It can take 2-4 hours after release before your artifacts show up in search results on search.maven.org
At this point, you can finally import the updated version of the SDK into your project.
<dependency>
<groupId>org.stellar.anchor-sdk</groupId>
<artifactId>core</artifactId>
<version>${version}</version>
</dependency>
implementation group: 'org.stellar.anchor-sdk', name: 'core', version: '${version}'
implementation("org.stellar.anchor-sdk:core:${version}")