【问题标题】:pgp signature failure on publishing artifact发布工件时 pgp 签名失败
【发布时间】:2018-11-09 10:06:52
【问题描述】:

这是我第一次尝试发布工件,而且再难了。

我正在使用sbt 0.13.8和插件sbt-release 1.0.8sbt-sonatype 2.0sbt-pgp 1.1.1

我构建 sbt 的相关部分如下所示:

pgpSecretRing := file("""C:\Users\kali\.sbt\gpg\secring.asc""")
pgpPublicRing := file("""C:\Users\kali\.sbt\gpg\pubring.asc""")
//pgpSecretRing := file("""C:\Users\kali\AppData\Local\lxss\home\kali\.gnupg\secring.gpg""")
//pgpPublicRing := file("""C:\Users\kali\AppData\Local\lxss\home\kali\.gnupg\pubring.gpg""")
usePgpKeyHex("c500a525a2efcb99")

name := "project-name"
organization := "com.mehmetyucel"
version := "0.0.2-SNAPSHOT"
scalaVersion := "2.12.2"
crossScalaVersions := Seq("2.11.11", "2.12.2")

lazy val projectName = project in file(".")

homepage := Some(url("https://some-github-url"))
scmInfo := Some(
  ScmInfo(url(
    "some-github-url"),
    "some-github-url.git"))

developers := List(
  Developer(
    "mehmetyucel",
    "Mehmet Yucel",
    "mehmet@mehmetyucel.com",
    url("some-github-url")))

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
publishMavenStyle := true

publishTo := Some(
  if (isSnapshot.value)
    Opts.resolver.sonatypeSnapshots
  else
    Opts.resolver.sonatypeStaging
)

releaseCrossBuild := true

releaseProcess := Seq[ReleaseStep](
  checkSnapshotDependencies,
  inquireVersions,
  runClean,
  runTest,
  setReleaseVersion,
  commitReleaseVersion,
  tagRelease,
  // For non cross-build projects, use releaseStepCommand("publishSigned")
  releaseStepCommandAndRemaining("+publishSigned"),
  setNextVersion,
  commitNextVersion,
  releaseStepCommand("sonatypeReleaseAll"),
  pushChanges
)

这里的前 5 行是我出于绝望添加的,因为当我执行 sbt release“我认为”时,它会使用我不知道的密钥签署我的包。

我得到的错误信息是:

[info] Evaluate: signature-staging
[info] Failed: signature-staging, failureMessage:No public key: Key with id: (5b09423c9d5fbb5d) was not able to be located on <a href="http://keyserver.ubuntu.com:11371/">http://keyserver.ubuntu.com:11371/</a>. Upload your public key and try the operation again.

但我的密钥已经上传。我可以去 keyserver.ubuntu.com (http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC500A525A2EFCB99) 上找到我的密钥,不幸的是你会意识到这里的密钥 ID 是不同的。而且我不知道这个“5b09423c9d5fbb5d”是从哪里来的。

我尝试将存储库克隆到 3 个不同的系统(macos、ubuntu 和 win10)中创建一个全新的密钥,将密钥上传到 ubuntu 密钥服务器并尝试再次释放它。错误消息中的 id 总是相同的 (5b09423c9d5fbb5d) 我不知道这是从哪里来的以及它是如何相同的,尽管使用了完全不同的密钥/系统

我尝试将usePgpKeyHex("c500a525a2efcb99") 更改为usePgpKeyHex("c500a525a2efcb91")(基本上不存在的东西),我得到了

[error] Not a valid command: failure-- (similar: onFailure)
[error] Not a valid project ID: failure--
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: failure--
[error] failure--
[error]          ^ 

在签名阶段,太棒了,这实际上意味着 sbt 正在使用我的密钥进行签名,所以 5b09423c9d5fbb5d 来自哪里?

【问题讨论】:

    标签: scala maven sbt sonatype


    【解决方案1】:

    已解决: 显然,这个密钥 id 来自我为这个项目所做的第一个“publishSigned”,但由于另一个原因而失败。我连续运行了很多次publishSignedsonatypeRelease,这导致在 sonatype 中出现了很多“开放”的暂存存储库。

    我去了https://oss.sonatype.org/并使用nexus UI删除了所有打开的临时存储库并重新启动了发布过程,一切正常。

    【讨论】:

      猜你喜欢
      • 2018-09-20
      • 2012-06-04
      • 2011-04-03
      • 2016-03-20
      • 2022-10-24
      • 2017-02-02
      • 2020-06-29
      • 2013-09-28
      • 1970-01-01
      相关资源
      最近更新 更多