maven deploy项目发布到中央仓库GPG签名失败signing failed: No secret key
执行操作
在我执行命令打包项目到中央仓库时失败
mvn clean deploy
错误信息
[INFO] --- gpg:3.1.0:sign (sign-artifacts) @ LocalCache ---
[INFO] Signing 4 files with 9961AA14xxxxxxxxxxxxxxD0646C8D232 secret key.
gpg: skipped "9961AA14Bxxxxxxxxxxxx646C8D232": No secret key
gpg: signing failed: No secret key
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.867 s
[INFO] Finished at: 2024-05-12T02:20:34+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:3.1.0:sign (sign-artifacts) on project LocalCache: Exit code: 2 -> [Help 1]
问题原因
原因是项目里配置的gpg.homedir不对,要改为你创建gpg密钥对时提示的那个路径
用这个路径,记得\要替换为
解决结果
然后就打包成功了
还没解决的话参考我的博客,按步骤来,肯定可以的。我换了电脑也可以
原创java开源项目发布maven全球中央仓库详细过程示范和遇到的问题解决办法