3

我正在尝试将我的学校项目添加到 Maven 存储库。我正在关注本教程:https ://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/ 。我已经成功生成了一个密钥和密码,并且我已经将该链接中的插件添加到了我的 pom 文件中。

当我运行命令mvn clean deploy -Dgpg.passphrase=mypassphrase时,它说

[ERROR] Unknown lifecycle phase ".passphrase=...". You must specify a valid lifecycle phase or a goal in
the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. 
Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-
resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, 
generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-
package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, 
pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

如果我只运行mvn clean deploy它说

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (sign-artifacts) on
project game-engine: Unable to execute gpg command: Error while executing process. 
Cannot run program "gpg.exe": CreateProcess error=2, The system cannot find the file specified -> [Help 1]

我试图谷歌这个,但我无法找到完全相同的问题。我在 Windows 10 上运行这个项目。

4

1 回答 1

1

而不是maven-gpg-plugin用于签名,您可以尝试另一个插件https://www.simplify4u.org/sign-maven-plugin/用于签名不需要外部软件,如gpg.

sign-maven-plugin在内部使用 Bouncy Castle 库,因此签名过程不依赖于操作系统。

它也不取决于您使用的控制台,如果您可以运行 maven build - 签名将是有效的。

于 2021-02-09T19:22:18.073 回答