如何使用从sbt pgp签名的publishSigned发布到Sonatype?
我想使用sbt pgp 0.8发布带有sbt的Scala库。我已经在Sonatype上注册了groupId如何使用从sbt pgp签名的publishSigned发布到Sonatype?,sbt,nexus,sonatype,Sbt,Nexus,Sonatype,我想使用sbt pgp 0.8发布带有sbt的Scala库。我已经在Sonatype上注册了groupIdorg.bitbucket.sergey_kozlov 我的构建.sbt: organization := "org.bitbucket.sergey_kozlov" name := "playingcards" version := "0.1-SNAPSHOT" publishMavenStyle := true publishTo := { val nexus = "ht
org.bitbucket.sergey_kozlov
我的构建.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"
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不包含组织机构
如何才能正确发布我的工件?正如您指出的,您的URL缺少组织属性,这就是您出现此错误的原因。尝试在sbt控制台中运行
显示组织
,以确保组织属性正确。如果没有帮助,请尝试在sbt中明确指定您的项目,并在那里设置组织属性
lazy val core = (project in file(".")).settings(
organization := "org.bitbucket.sergey_kozlov"
//other properties here
)
我没有立即在您的
build.sbt
文件中看到任何问题。您是否有任何project/*.scala
文件可能正在处理预期值?您的project/plugins.sbt
是什么?我怀疑publishSigned
来自或。@joescii我在project
目录中没有*.scala
文件。@JacekLaskowski我的project/plugins.sbt
只包含logLevel:=Level.Warn
,但有~/.sbt/0.13/plugins/gpg.sbt
这样的内容:addSbtPlugin(“com.typesafe.sbt”%“sbt pgp”%“0.8”)
谢谢您的回答,我会试试这个。