Maven 在哪里为Windows上运行的Jenkins保留GPG密钥?

Maven 在哪里为Windows上运行的Jenkins保留GPG密钥?,maven,jenkins,Maven,Jenkins,我正试图使用Jenkins将我的工件发布到OSS Sonatype Nexus服务器。但是当尝试对工件进行签名时,我得到了以下错误。我已经生成了我的gpg密钥,并将其放在Windows计算机上的C:/Users/Sara/AppData/Roaming/gnupg文件夹下。从另一个问题中,我可以看出答案是针对基于Unix的环境的。在windows环境中,有人能告诉我们在哪里放置jenkins的密钥吗 [INFO] --- maven-gpg-plugin:1.1:sign (sign-artif

我正试图使用Jenkins将我的工件发布到OSS Sonatype Nexus服务器。但是当尝试对工件进行签名时,我得到了以下错误。我已经生成了我的gpg密钥,并将其放在Windows计算机上的C:/Users/Sara/AppData/Roaming/gnupg文件夹下。从另一个问题中,我可以看出答案是针对基于Unix的环境的。在windows环境中,有人能告诉我们在哪里放置jenkins的密钥吗

[INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) @ StudentEnrollmentWithREST ---
    gpg: no default secret key: secret key not available
    gpg: signing failed: secret key not available
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1:27.647s
    [INFO] Finished at: Mon Jan 20 12:12:27 CST 2014
    [INFO] Final Memory: 22M/53M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.1:sign (sign-artifacts) on project StudentEnrollmentWithREST: Exit code: 2 -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:45.118s
[INFO] Finished at: Mon Jan 20 12:12:33 CST 2014
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project StudentEnrollmentWithREST: Maven execution failed, exit code: '1' -> [Help 1]
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\workspace\Upload REST Release Artifacts\pom.xml to com.github.elizabetht/StudentEnrollmentWithREST/1.3-SNAPSHOT/StudentEnrollmentWithREST-1.3-SNAPSHOT.pom
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Finished: FAILURE
根据文件。
默认为
~/.gnupg
%APPDATA%/gnupg
${gpg.homedir}
应该在您当前描述的文件夹中找到您的钥匙圈。 默认情况下,还可以配置名为
publing.gpg
secring.gpg
的文件

也许问题在于找到正确的键,maven使用“默认键”,除非另有配置。 钥匙圈中的第一个钥匙是默认钥匙

选择一个键-这可能在项目/父项或设置中,甚至在命令行中

<properties>
    <gpg.keyname>C78F3CC4</gpg.keyname>
</properties>

C78F3CC4
其他一些配置更可能是“每主机”,可能是settings.xml中的配置文件

<profile>
    <id>gpg-release</id>
    <properties>
        <gpg.passphrase>...</gpg.passphrase>
        <gpg.useagent>true</gpg.useagent>
<!--
        <gpg.defaultKeyring>false</gpg.defaultKeyring>
        <gpg.homedir>/private/.../.gnupg</gpg.homedir>
        <gpg.publicKeyring>/private/.../.gnupg/pubring.gpg</gpg.publicKeyring>
        <gpg.secretKeyring>/private/.../.gnupg/secring.gpg</gpg.secretKeyring>
-->
    </properties>
</profile>

gpg释放
...
真的
如果将命令行与OSS Sonatype一起使用,而不是在设置xml中使用,则需要进一步练习。
来自。
因为maven release插件将启动一个新的maven实例,
-Dgpg.passphrase=passphrase
在这种情况下不起作用,您应该使用
mvn发布:执行-Darguments=-Dgpg.passphrase=passphrase

[并在项目pom中配置${arguments}的用法]

添加概要文件部分,如下所示,在settings.xml中:

<profile> 
<id>gpg-release</id> 
<properties> 
<gpg.passphrase>password</gpg.passphrase> 
<gpg.useagent>true</gpg.useagent> 
<gpg.defaultKeyring>false</gpg.defaultKeyring> <gpg.homedir>C:/Users/User/AppData/Roaming/gnupg</gpg.homedir> <gpg.publicKeyring>C:/Users/User/AppData/Roaming/gnupg/pubring.gpg</gpg.publicKe‌​yring> <gpg.secretKeyring>C:/Users/User/AppData/Roaming/gnupg/secring.gpg</gpg.secre‌​tKeyring> </properties> 
</profile>

gpg释放
密码
真的
false C:/Users/User/AppData/Roaming/gnupg C:/Users/User/AppData/Roaming/gnupg/pubring.gpg C:/Users/User/AppData/Roaming/gnupg/secring.gpg

您可以将GPG密钥保存在管理Jenkins/configure系统的Jenkins中。有一个RPM签名密钥部分,您可以在其中添加GPG密钥。在您应该在Jenkins中添加所需插件之前