31
loading...
This website collects cookies to deliver better user experience
Note: throughout this guide, I assume that your source code is hosted in a GitHub repository, and so all instructions are GitHub-specific.
io.github.awwsmm
, or similar for your GitHub username. See this guide for more information on package coordinates.❗ GOTCHA: this should not be something like com.github.awwsmm
. com.github
coordinates are no longer supported.
https://github.com/awwsmm/zepto
, but it could be a github.io
page or a page on your personal website, or whatever.https://github.com/awwsmm/zepto.git
.brew install gnupg
) and verify that it's installed by checking the version$ gpg --version
gpg (GnuPG) 2.3.1
...
$ gpg --gen-key
$ gpg --list-keys
gpg: checking the trustdb
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2023-07-11
/Users/andrew.watson/.gnupg/pubring.kbx
---------------------------------------
pub ed25519 2021-07-11 [SC] [expires: 2023-07-11]
1234517530FB96F147C6A146A326F592D39AAAAA
uid [ultimate] Andrew Watson <[email protected]>
sub cv25519 2021-07-11 [E] [expires: 2023-07-11]
$ gpg --keyserver keyserver.ubuntu.com --send-keys
1234517530FB96F147C6A146A326F592D39AAAAA
gpg: sending key A326F592D39AAAAA to hkp://keyserver.ubuntu.com
❗ GOTCHA: scala-sbt's guide tells you to distribute the key to hkp://pool.sks-keyservers.net
, but this causes a keyserver send failed: No name
error, as the keyserver is no longer active. You can instead use any other major GPG keyserver, like the Ubuntu one I used above.
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
$HOME/.sbt/1.0/sonatype.sbt
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credentials")
~/.sbt/sonatype_credentials
realm=Sonatype Nexus Repository Manager
host=s01.oss.sonatype.org
user=<your username>
password=<your password>
user
and password
here are the same username and password you used when creating your account on Sonatype's Jira server in Step 1. You don't need to worry about putting anything in quotes here -- spaces are fine. But...❗ GOTCHA: ...be careful! The guide at scala-sbt.org
says to set host=oss.sonatype.org
, but this has recently changed to host=s01.oss.sonatype.org
. More information about this change can be found here.
build.sbt
(or, as I recommend) publish.sbt
file.username
with your GitHub username below, project
with the name of the project (in my case, these are awwsmm
and zepto
, respectively), and all the other obvious fill-in bits, and paste it into a publish.sbt
file at the root of your projectThisBuild / organization := "io.github.username"
ThisBuild / organizationName := "username"
ThisBuild / organizationHomepage := Some(url("https://www.yourwebsite.com"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/username/project"),
"scm:[email protected]/project.git"
)
)
ThisBuild / developers := List(
Developer(
id = "username",
name = "Your Name Goes Here",
email = "[email protected]",
url = url("https://www.yourwebsite.com")
)
)
ThisBuild / description := "Describe your project here..."
ThisBuild / licenses := List("The Unlicense" -> new URL("https://unlicense.org/"))
ThisBuild / homepage := Some(url("https://github.com/username/project"))
// Remove all additional repository other than Maven Central from POM
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / publishMavenStyle := true
ThisBuild / versionScheme := Some("early-semver")
licenses
to whatever you feel is appropriate. Here is GitHub's guide to choosing a license for your repo -- though be aware that they probably ignore it anyway.❗ GOTCHA: Notice that we've also used s01.oss.sonatype.org
above!
sbt
shell with the publishSigned
commandsbt:zepto> publishSigned
[info] Wrote /local/path/to/zepto_2.13-0.4.0.pom
[info] published zepto_2.13 to https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/awwsmm/zepto_2.13/0.4.0/zepto_2.13-0.4.0-sources.jar
[info] published zepto_2.13 to https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/awwsmm/zepto_2.13/0.4.0/zepto_2.13-0.4.0-javadoc.jar
[info] published zepto_2.13 to https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/io/github/awwsmm/zepto_2.13/0.4.0/zepto_2.13-0.4.0-javadoc.jar.asc
...
Close
from the menu, and then Release
. You should see your project on Maven almost immediately, though it will take a few hours to show up in the search engine."io.github.awwsmm" %% "zepto" % "0.4.0"
libraryDependencies
in the build.sbt
of another project.