Publish your Java SDK with Maven
To make your Java SDK publicly accessible, publish to Maven Central. Once you’ve followed the steps below to connect your Maven account to your SDK, Fern will automatically publish the latest version of your SDK.
For more information on the differences between the Central Portal and OSSRH, see the Maven Central documentation.
Publish via the Central Portal (recommended)
Confirm generation
You will be asked to confirm the generation of the token. This will invalidate any existing token. Click on Ok
.
Add Maven Central credentials to GitHub Secrets
You’ll need to store two repository secrets in your fern configuration repository (i.e. not the Java SDK repository), one for the username and one for the password.
For each, select New repository secret. Name your secret (we recommend MAVEN_USERNAME
and MAVEN_PASSWORD
,
respectively), add the corresponding value, and click Add secret.
Sign with GPG
If you don’t have gpg installed, you can download the binary from https://gnupg.org/download/index.html, or install it via package manager.
If you already have a GPG key, you can list your keys:
If you don’t have a GPG key, you can generate a new one:
To export your secret key, run:
Be sure to replace KEY_ID
with the key ID of the key you want to export.
More information is available on Maven Central’s GPG validation page.
Add GPG Signature to GitHub Secrets
You’ll need to store repository secrets in your fern configuration repository, for the GPG key id, secret key, and password.
For each, select New repository secret. Name your secret (we recommend MAVEN_CENTRAL_SECRET_KEY_KEY_ID
, MAVEN_CENTRAL_SECRET_KEY
, and MAVEN_CENTRAL_SECRET_KEY_PASSWORD
, respectively), add the corresponding value, and click Add secret.
Once you regenerate your SDK, a GitHub action will run to publish directly to Maven!
Publish via OSSRH (legacy)
Click on Access User Token
There will be a lock icon followed by the text Access User Token
. Click on Access User Token
. You may
need to re-authenticate to see the user token.
Add GitHub Secrets
You’ll need to store two repository secrets in your fern configuration repository (i.e. not the Java SDK repository), one for the username and one for the password.
For each, select New repository secret. Name your secret (we recommend MAVEN_USERNAME
and MAVEN_PASSWORD
,
respectively), add the corresponding value, and click Add secret.
Once you regenerate your SDK, a GitHub action will run to publish directly to Maven!