Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to publish to Sonatype using publishSigned from sbt-pgp?

0 like 0 dislike
287 views

I want to publish a Scala library with sbt using sbt-pgp 0.8. I've registered groupId org.bitbucket.sergey_kozlov at Sonatype.

My build.sbt:

organization := "org.bitbucket.sergey_kozlov"

name := "playingcards"

version := "0.1-SNAPSHOT"

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 }

pomExtra :=
        <url>https://bitbucket.org/sergey_kozlov/playingcards</url>
        <licenses>
            <license>
                <name>The MIT License</name>
                <url>http://www.opensource.org/licenses/mit-license.php</url>
                <distribution>repo</distribution>
            </license>
        </licenses>
        <scm>
            <url>https://bitbucket.org/sergey_kozlov/playingcards.git</url>
            <connection>scm:git:ssh://git@bitbucket.org/sergey_kozlov/playingcards.git</connection>
        </scm>
        <developers>
            <developer>
                <id>skozlov</id>
                <name>Sergey Kozlov</name>
                <email>mail.sergey.kozlov@gmail.com</email>
                <roles>
                    <role>architect</role>
                    <role>developer</role>
                </roles>
            </developer>
        </developers>

libraryDependencies += "junit" % "junit" % "4.11"

libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.0" % "test"

There's also ~/.sbt/0.13/plugins/gpg.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")

No other files are under project/ directory that contribute to the build definition.

When I enter publishSigned in sbt console, I get the following error:

[error] (*:publishSigned) java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/playingcards/playingcards_2.10/0.1-SNAPSHOT/playingcards_2.10-0.1-SNAPSHOT-sources.jar was refused by the server: Forbidden

Note that the URL does not contain organization.

How can I publish my artifact correctly?

asked Jan 24, 2015 by user1559111  
I don't immediately see any issues in your build.sbt file. Do you have any project/*.scala files which may be manipulating the expected values?
What's your project/plugins.sbt? I suspect that publishSigned comes from https://github.com/sbt/sbt-pgp or https://github.com/xerial/sbt-sonatype
@joescii I have no *.scala files in the project directory.
@JacekLaskowski My project/plugins.sbt contains only logLevel := Level.Warn, but there is ~/.sbt/0.13/plugins/gpg.sbt with such content: addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...