我尝试使用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",
...credentials ~/.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: <html>
<head>我错过了什么吗?
发布于 2021-04-19 00:58:28
似乎只有在project中运行该命令时才会采用这些设置。
sbt> project server
sbt> sonatypeBundleRelease这可以解决这个问题,或者至少解决了这个问题。
https://stackoverflow.com/questions/67150581
复制相似问题