A plugin for deploying open-source artifacts to Maven via the Sonatype Central portal
Prerequisites: Make sure that you are running sbt 1.9.0 or higher.
- Add the following to your
project/plugins.sbt
file (or equivalent):
addSbtPlugin("com.lumidion" % "sbt-sonatype-central" % "0.1.0") //For deploying your lib to Sonatype Central
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") //For signing the lib before it is deployed
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1") //For adding source control information to your package.
- Make sure that your version is not a snapshot (Sonatype Central does not support publishing snapshot versions).
Add the following to your
build.sbt
file (or equivalent):
publishTo := sonatypeCentralPublishToBundle.value
-
Follow the guide to setting up your gpg credentials here if you have not already done so.
-
Generate a portal token in Sonatype Central, as illustrated in the following guide. Set the resultant username and password in your environment via the
SONATYPE_USERNAME
andSONATYPE_PASSWORD
environment variables. -
Start the sbt shell by running
sbt
. -
Run
publishSigned
from the sbt shell and input your gpg password when prompted. -
Run either
sonatypeCentralUpload
orsonatypeCentralRelease
from the sbt shell.