The following is a guide on how to publish your SDK (referred to as an artifact
) to Maven Central.
Step 1: Decide what your Maven groupId
will be .
We recommend using a reverse domain name, as it's a common convention and it's easy to remember.
For example:
stripe.com
becomescom.stripe
aws.amazon.com
becomescom.amazonaws
twilio.com
becomescom.twilio.sdk
(they addedsdk
to avoid a conflict with an existing groupId)archive.org
becomesorg.archive
zookeeper.apache.org
becomesorg.apache.zookeeper
Alternatively, you can use your GitHub org name. For example, github.com/segmentio
becomes io.segment
.
Step 2: Create an account on Sonatype Jira. Create an account here.
Sonatype is a company that runs the Maven Central Repository, which is where we will be uploading our artifacts to.
Step 3: Create a new issue by hitting the Create button.
Step 4: Fill out the form.
-
Select
Community Support - Open Source Project Repository Hosting (OSSRH)
for Project. -
Select
New Project
for Issue Type.
Step 5: Prove ownership in the ticket.
Before granting you the groupId
you requested, Sonatype will ask you to prove ownership of either the GitHub org or domain name that you based your groupId
on.
In the case of a domain name, you will be asked to add a DNS TXT to your domain. Example ticket here.
In the case of GitHub org, you will be asked to create a repo and the bot will check that the repo has been created. Example ticket here.
Step 6: You're ready to publish to your Maven repository!
- Your
Maven coordinate
is<groupId>:<artifactId>
- Your
Maven username
is the username of your Sonatype account. - Your
Maven password
is the password of your Sonatype account.
Step 7: Choose your artifact name.
Picking an artifactId
is a personal preference. Here are examples for inspiration:
stripe-java
[this is our recommended approach]slack-api-client
twilio
aws-java-sdk-s3
Going forward, when referencing the artifact you'll use the groupId
and artifactId
together. For example:
com.stripe:stripe-java
com.slack.api/slack-api-client
dev.merge:merge-java-client
com.amazonaws:aws-java-sdk-s3