Publishing to Maven Central
Publish your public-facing Fern Java SDK to the Maven Central registry. After following the steps on this page, you’ll have a versioned package published on Maven Central.
This page assumes that you have:
- An initialized
fern
folder. See Set up thefern
folder. - A GitHub repository for your SDK. See Project Structure.
Configure generators.yml
Configure output
location
Change the output location in generators.yml
from local-file-system
(the default) to maven
to indicate that Fern should publish your package directly to the Maven Central registry.
Then, add publish-to: central
to indicate that the publish target is the new Maven Central Portal (Sonatype). To publish to the legacy Nexus Repository, use publish-to: ossrh
.
Set up Maven Central publishing authentication
Verify your namespace
- Click on your username, then select View Namespaces. Click Register New Namespace.
- Enter your company website or GitHub account in reverse domain name format and go through the verification process.
Configure Maven Coordinate
Add the namespace you just verified in Maven Central to the coordinate
field. This specifies how your Java SDK will be
published and referenced in the Maven Central respository.
Generate GPG Signature
Next, set up code signing credentials by generating or identifying a GPG key ID, password, and secret key. Maven Central requires all artifacts to be digitally signed with PGP/GPG keys.
Find your key
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:
You’ll be prompted to create a new username and passphrase.
Export your key
Export your key so you can store it in an environment variable later on:
Be sure to replace YOUR_KEY_ID
with the key ID of the key you want to export.
Release your SDK to Maven Central
At this point, you’re ready to generate a release for your SDK.