Skip to content

Instantly share code, notes, and snippets.

@OlegIlyenko
Last active September 21, 2015 18:08
Show Gist options
  • Save OlegIlyenko/6ced7ece00f5a951c04a to your computer and use it in GitHub Desktop.
Save OlegIlyenko/6ced7ece00f5a951c04a to your computer and use it in GitHub Desktop.
SBT maven central publishing setup (after the setup just execute `sbt publishSigned`)
// In your project
// General stuff like name, description, version
// Publishing
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := (_ => false)
publishTo := Some(
if (version.value.trim.endsWith("SNAPSHOT"))
"snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
else
"releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
// nice *magenta* prompt! (the most important part)
shellPrompt in ThisBuild := { state =>
scala.Console.MAGENTA + Project.extract(state).currentRef.project + "> " + scala.Console.RESET
}
// Additional meta-info reqired by maven central
startYear := Some(2015)
organizationHomepage := Some(url("https://github.com/my-org-or-user"))
developers := Developer("GitHubUserName", "Full Name", "", url("https://github.com/my-username")) :: Nil
scmInfo := Some(ScmInfo(
browseUrl = url("https://github.com/my-username/my-project.git"),
connection = "scm:git:[email protected]:my-username/my-project.git"
))
// In ~/.sbt/0.13/plugins/build.sbt
resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
// In ~/.sbt/0.13/sonatype.sbt
pgpSecretRing := file("""/path/to/my/gnupg/secring.gpg""")
pgpPublicRing := file("""/path/to/my/gnupg/pubring.gpg""")
pgpPassphrase := Some(Array('m', 'y', '_', 'g', 'p', 'g', '_', 'p', 'a', 's', 's', 'w', 'o', 'r', 'd'))
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"my-oss.sonatype.org-username",
"my-oss.sonatype.org-password")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment