缺少凭证找不到oss.sonatype.org的凭证

qmb5sa22  于 2021-07-14  发布在  Java
关注(0)|答案(1)|浏览(368)

我尝试使用sbt sonatype插件将我的项目发布到maven central。
请遵循以下说明:https://github.com/xerial/sbt-sonatype#buildsbt
我有以下配置:

lazy val publicationSettings: Project => Project = _.settings(
    publishMavenStyle := true,
    publishTo := sonatypePublishToBundle.value,
    sonatypeCredentialHost := "s01.oss.sonatype.org",
    sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
    ...

证书 ~/.sbt/1.0/sonatype.sbt :

credentials += Credentials("Sonatype Nexus Repository Manager",
        "s01.oss.sonatype.org",
        "myUser",
        "myPassword")
``` `plugins.sbt` :

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")

但不知怎的,它仍然在寻找 `oss.sonatype.org` :

sbt> sonatypeBundleRelease
[MISSING_CREDENTIAL] No credential is found for oss.sonatype.org. Prepare ~/.sbt/(sbt_version)/sonatype.sbt file.
at xerial.sbt.sonatype.SonatypeClient.$anonfun$directCredentials$1(SonatypeClient.scala:45)
at scala.Option.getOrElse(Option.scala:189)

如果我把主机改成 `oss.sonatype.org` 在凭证中,我得到以下信息:

2021-04-18 17:53:04.183+0200 info [SonatypeService] sonatypeRepository : https://oss.sonatype.org/service/local - (SonatypeService.scala:23)
2021-04-18 17:53:04.185+0200 info [SonatypeService] sonatypeProfileName : pme123 - (SonatypeService.scala:24)
2021-04-18 17:53:04.186+0200 info [SonatypeClient] Reading staging repository profiles... - (SonatypeClient.scala:108)
[info] Preparing a new staging repository for [sbt-sonatype] camunda-dmn-tester-root 0.11.0-SNAPSHOT
2021-04-18 17:53:04.544+0200 info [SonatypeClient] Reading staging profiles... - (SonatypeClient.scala:120)
2021-04-18 17:53:04.685+0200 error [Sonatype]
wvlet.airframe.http.HttpClientException: [403: Forbidden] Request failed:

gzszwxb4

gzszwxb41#

似乎只有在 project .

sbt> project server
sbt> sonatypeBundleRelease

这是有效的,或者至少解决了这个问题。

相关问题