我想使用 sbt-pgp 0.8 发布带有 sbt 的 Scala 库。我已经在 Sonatype 注册了 groupId org.bitbucket.sergey_kozlov
。
我的 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"
还有 ~/.sbt/0.13/plugins/gpg.sbt :
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
project/
目录下没有其他有助于构建定义的文件。当我在 sbt 控制台中输入
publishSigned
时,出现以下错误:[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
请注意,该 URL 不包含
organization
。如何正确发布我的工件?
最佳答案
正如您指出的,您的 URL 缺少 组织 属性,这就是您收到此错误的原因。尝试在 sbt 控制台中运行 show organization
以确保您的组织属性正确。如果它没有帮助,请尝试在 sbt 中明确指定您的项目并在那里设置 组织 属性。
lazy val core = (project in file(".")).settings(
organization := "org.bitbucket.sergey_kozlov"
//other properties here
)
关于sbt - 如何使用来自 sbt-pgp 的 publishSigned 发布到 Sonatype?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24837023/