sbt-aws-cloudformationをMaven Centralに登録したときの手順メモ

上記を参考に作成したSBTプラグインMaven Centralに登録した手順です。

Sonatypeの設定とPublishの手順は、OSSRH Guideに記述されています。 2つの有効なURLが必要です。

SonatypeのJIRAにアカウントを作成します。 アカウントを作成したら、チケットを登録します。

GPGキーの作成とキーサーバに公開キーの送信を行います。私は、MacBookなので、GPG Suiteを使いました。

~/.sbt/0.13/sonatype.sbtにSonatypeのJIRAアカウントの情報を記述します。

credentials += Credentials("Sonatype Nexus Repository Manager",
                           "oss.sonatype.org",
                           "<your username>",
                           "<your password>")

プロジェクトのpublish.sbtに以下の内容を記述します。

publishMavenStyle := true

publishTo := {
  val nexus = "https://oss.sonatype.org/"
  if (isSnapshot.value)
    Some("snapshots" at nexus + "content/repositories/snapshots")
  else
    Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

publishArtifact in Test := false

pomIncludeRepository := { _ => false }

sonatypeProfileName := "com.pigumer.sbt.cloud"

pomExtra := (
  <url>https://github.com/PigumerGroup/sbt-aws-cloudformation</url>
    <licenses>
      <license>
        <name>MIT</name>
        <url>https://opensource.org/licenses/MIT</url>
      </license>
    </licenses>
    <scm>
      <url>https://github.com/PigumerGroup/sbt-aws-cloudformation</url>
      <connection>https://github.com/PigumerGroup/sbt-aws-cloudformation.git</connection>
    </scm>
    <developers>
      <developer>
        <id>JIRA_ACCOUNT</id>
        <name>NAME</name>
        <url>https://github.com/takesection</url>
      </developer>
    </developers>)

project/plugins.sbtに以下の記述をします。

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

sbtを起動します

sbt

コンパイル

> compile

テスト(Optional)

> scripted

署名タスクとリリースタスクを実行します。

> publishSigned
> sonatypeRelease