Skip to content

Instantly share code, notes, and snippets.

@cornerman
Forked from fdietze/Sbt Sonatype Publishing.md
Last active December 29, 2016 22:29
Show Gist options
  • Save cornerman/218f12a5a77bdaae901548359cc139b8 to your computer and use it in GitHub Desktop.
Save cornerman/218f12a5a77bdaae901548359cc139b8 to your computer and use it in GitHub Desktop.
Sbt Sonatype

generate key pair

$ sbt "set pgpReadOnly := false" "pgp-cmd gen-key"

sonatype publishing

build.sbt:

pgpSecretRing in Global := file("secring.gpg")
pgpPublicRing in Global := file("pubring.gpg")
organization in Global := "com.github.bla"

pomExtra := {
  <url>https://github.com/renesca/renesca</url>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <scm>
    <url>https://github.com/renesca/renesca</url>
    <connection>scm:git:git@github.com:renesca/renesca.git</connection>
  </scm>
  <developers>
    <developer>
      <id>fdietze</id>
      <name>Felix Dietze</name>
      <url>https://github.com/fdietze</url>
    </developer>
    <developer>
      <id>snordquist</id>
      <name>Sascha Nordquist</name>
      <url>https://github.com/snordquist</url>
    </developer>
    <developer>
      <id>jkaroff</id>
      <name>Johannes Karoff</name>
      <url>https://github.com/cornerman</url>
    </developer>
  </developers>
}

plugins.sbt

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

sonatype.sbt

import com.typesafe.sbt.SbtPgp._

// this has to go in an sbt file because if we use an external
// credentials properties file it ignores it
credentials in Global += Credentials(
  "Sonatype Nexus Repository Manager",
  "oss.sonatype.org",
  "felixdz",
  "**********"
)

pgpPassphrase in Global := Some("".toCharArray)

snapshots

$ sbt publishSigned

releases

TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment