如何配置 sbt 发布到私有 nexus maven 仓库?

How to configure sbt to publish to private nexus maven repo?

[error] (*:publish) java.io.IOException: PUT operation to URL http://corporate.nexus:8081/repository/snapshots/service/local/staging/deploy/1.0/foo-1.0.pom failed with status code 503: Service Unavailable [error] Total time: 23 s, completed Jun 9, 2017 12:09:15 PM

我在尝试使用 sbt publish 将我的 jar 发布到我的 nexus 存储库 3.13 maven 存储库时遇到此错误。

我在build.sbt

中有如下配置
publishTo := { 
 val nexus = "http://corporate.nexus:8081/repository/snapshots/"
  if (isSnapshot.value)
   Some("snapshots" at nexus + "content/repositories/snapshots") 
  else
   Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

credentials += Credentials("Nexus Repository Manager", "corporate.nexus:8081/", "admin", "admin123")

publishMavenStyle := true

我可以使用 maven 2 [mvn deploy:deploy-file] 推送 jar。但不是 mvn 3。

Nexus 的域名必须 "Sonatype Nexus Repository Manager" 区分大小写。不确定在哪里可以找到 Nexus 的确切名称,以及它是否因版本而异。这适用于 Nexus 3。