我正在尝试通过SBT将scala库发布到OSS Sonatype存储库。我遵循了SBT出版指南0& Using Sonatype并查看了Sonatype requirements文档,但似乎无法发布我的工件。所有尝试都以java.io.IOException: Access to URL [...] was refused by the server: Forbidden
结束。我已经在Sonatype JIRA系统中完成了必要的存储库设置。我创建了一个PGP密钥并将其发布到hkp://pool.sks-keyservers.net
& hkp://keyserver.ubuntu.com
。
build.sbt
import play.twirl.sbt.SbtTwirl
name := "spring-mvc-twirl"
organization := "us.hexcoder"
version := "1.0.0-SNAPSHOT"
scalaVersion := "2.11.2"
sbtVersion := "0.13.5"
lazy val root = (project in file(".")).enablePlugins(SbtTwirl)
// Removed for brevity
libraryDependencies ++= Seq()
// Test dependencies
// Removed for brevity
libraryDependencies ++= Seq()
// Publish configurations
publishMavenStyle := true
publishArtifact in Test := false
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")
}
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT"))
homepage := Some(url("https://github.com/67726e/Spring-MVC-Twirl"))
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
pomIncludeRepository := { _ => false }
// Additional POM information for releases
pomExtra :=
<developers>
<developer>
<name>Glenn Nelson</name>
<email>glenn@hexcoder.us</email>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:67726e/Spring-MVC-Twirl.git</connection>
<developerConnection>scm:git:git@github.com:67726e/Spring-MVC-Twirl.git</developerConnection>
<url>git@github.com:67726e/Spring-MVC-Twirl.git</url>
</scm>
SBT输出:
> publishSigned
[info] Wrote /Users/67726e/Documents/Spring-MVC-Twirl/target/scala-2.11/spring-mvc-twirl_2.11-1.0.0-SNAPSHOT.pom
[info] :: delivering :: us.hexcoder#spring-mvc-twirl_2.11;1.0.0-SNAPSHOT :: 1.0.0-SNAPSHOT :: integration :: Tue Aug 19 09:57:13 EDT 2014
[info] delivering ivy file to /Users/67726e/Documents/Spring-MVC-Twirl/target/scala-2.11/ivy-1.0.0-SNAPSHOT.xml
[trace] Stack trace suppressed: run last *:publishSigned for the full output.
[error] (*:publishSigned) java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/us/hexcoder/spring-mvc-twirl_2.11/1.0.0-SNAPSHOT/spring-mvc-twirl_2.11-1.0.0-SNAPSHOT-sources.jar was refused by the server: Forbidden
[error] Total time: 5 s, completed Aug 19, 2014 9:57:18 AM
> last *:publishSigned
java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/us/hexcoder/spring-mvc-twirl_2.11/1.0.0-SNAPSHOT/spring-mvc-twirl_2.11-1.0.0-SNAPSHOT-sources.jar was refused by the server: Forbidden
at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:79)
at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:264)
at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
答案 0 :(得分:0)
事实证明,这是开发人员罕见的时期之一,问题不是由我造成的。我在Sonatype跟踪器上提交了一个JIRA ticket,但事实证明,在配置期间,我的工具导致我的帐户未被granted the correct permissions。
为了解决@ MikeAllen的评论,我已经创建了一个JIRA帐户,并通过提交JIRA票据作为其工作流程的一部分来创建我的存储库(这是在5天前完成的)。在我按目录浏览器中的时间戳所示推送第一个快照之前,未创建与我的hexcoder.us
- us/hexcoder
域/组对应的目录。它似乎不是在存储库配置期间创建的。
最后,我完全相信在调查和调试错误时,执行尽职调查是必要的。但是,不要像我经常做的那样把它带到极端,并且在花费了合理的时间之后忽略了向别人寻求帮助。