This document describes how to publish friendly-id artifacts to Maven Central using the new Sonatype Central Portal.
- Account on Central Portal: https://central.sonatype.com
- Namespace verified:
com.devskiller.friendly-id - GPG Key: For signing artifacts
- Maven credentials: Token configured in
~/.m2/settings.xml
Add your Central Portal credentials:
<servers>
<server>
<id>central</id>
<username>YOUR_USERNAME</username>
<password>YOUR_TOKEN</password>
</server>
</servers>Generate GPG key if you don't have one:
# Generate key
gpg --gen-key
# List keys
gpg --list-keys
# Export public key to keyserver
gpg --keyserver keyserver.ubuntu.com --send-keys YOUR_KEY_ID# Build and deploy snapshot
mvn clean deploySnapshots will be available at:
https://central.sonatype.com/artifact/com.devskiller.friendly-id/friendly-id/1.1.1-SNAPSHOT
- Update version (remove
-SNAPSHOTsuffix):
# Update version in pom.xml
mvn versions:set -DnewVersion=1.1.1
mvn versions:commit- Build and deploy with release profile:
# This will:
# - Create source JARs
# - Create javadoc JARs
# - Sign all artifacts with GPG
# - Deploy to Central Portal
mvn clean deploy -Prelease- Verify deployment:
- Go to https://central.sonatype.com/publishing/deployments
- Check deployment status
- Artifacts will be automatically published to Maven Central (autoPublish=true)
- Tag the release:
git tag -a 1.1.1 -m "Release version 1.1.1"
git push origin 1.1.1- Prepare next development version:
mvn versions:set -DnewVersion=1.1.2-SNAPSHOT
mvn versions:commit
git add pom.xml */pom.xml
git commit -m "chore: prepare next development version 1.1.2-SNAPSHOT"
git pushIf you get "gpg: signing failed: Inappropriate ioctl for device":
export GPG_TTY=$(tty)Or add to ~/.bashrc:
export GPG_TTY=$(tty)Make sure <id>central</id> in settings.xml matches <publishingServerId>central</publishingServerId> in pom.xml.
Check deployment status:
# List recent deployments
curl -u "YOUR_USERNAME:YOUR_TOKEN" \
https://central.sonatype.com/api/v1/publisher/deploymentsAfter successful deployment:
- Artifacts are immediately available on Central Portal
- Sync to Maven Central (repo1.maven.org) takes 10-30 minutes
- Search index update (search.maven.org) takes up to 2 hours
After publication, verify artifacts are available:
# Check on Central Portal
curl https://central.sonatype.com/artifact/com.devskiller.friendly-id/friendly-id/1.1.1
# Check on Maven Central (after sync)
curl https://repo1.maven.org/maven2/com/devskiller/friendly-id/friendly-id/1.1.1/For automated releases via GitHub Actions, you'll need to:
-
Add GitHub Secrets:
MAVEN_CENTRAL_USERNAMEMAVEN_CENTRAL_TOKENGPG_PRIVATE_KEYGPG_PASSPHRASE
-
Create
.github/workflows/release.ymlworkflow -
Use
central-publishing-maven-pluginin the workflow