jenkins 无法执行目标组织,apache,maven,插件:maven-gpg-插件

4smxwvx5  于 2023-02-21  发布在  Jenkins
关注(0)|答案(3)|浏览(348)

这个错误快把我逼疯了。有人能帮帮我吗?我确实安装了gpg,而且它也在路径中。是什么导致了这个错误!!!
我在jenkins 1.5,maven 3. 0. 3上运行这个作业在linux和windows上(都显示相同的错误)

[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (default) on project sample: Exit code: 2 -> [Help 1]
    [INFO] [ERROR] 
    [INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [INFO] [ERROR] 
    [INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4:53.571s
    [INFO] Finished at: Fri Aug 14 14:00:36 PDT 2015
    [INFO] Final Memory: 21M/620M
    [INFO] ------------------------------------------------------------------------
    [JENKINS] Archiving /var/lib/jenkins/jobs/sample/workspace/pom.xml to /var/lib/jenkins/jobs/sample/modules/com.sample$sample/builds/2015-08-14_13-55-35/archive/com.sample/sample/1.0.0-SNAPSHOT/sample-1.0.0-SNAPSHOT.pom
    Waiting for Jenkins to finish collecting data
    mavenExecutionResult exceptions not empty
    message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project sample: Maven execution failed, exit code: '1'
    cause : Maven execution failed, exit code: '1'
    Stack trace : 
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project sample: Maven execution failed, exit code: '1'
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
        at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:326)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Maven execution failed, exit code: '1'
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:281)
        at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:232)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 26 more
    Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Maven execution failed, exit code: '1'
        at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:89)
        at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.execute(RunPrepareGoalsPhase.java:44)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:277)
        ... 29 more
    Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: '1'
        at org.apache.maven.shared.release.exec.InvokerMavenExecutor.executeGoals(InvokerMavenExecutor.java:394)
        at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals(AbstractMavenExecutor.java:110)
        at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:81)
        ... 35 more
    channel stopped
    Archiving artifacts
    An attempt to send an e-mail to empty list of recipients, ignored.
    Finished: FAILURE
owfi6suc

owfi6suc1#

如果不需要对工件进行签名,可以禁用或跳过父pom中定义的gpg插件的执行

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>maven-gpg-plugin</artifactId>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

或使用gpg.skip=true运行构建(请参见Maven GPG Plugin
如果你需要你的工件被签名,你应该检查父pom中的gpg插件的配置或者覆盖你的pom中的配置。也许父pom中的一些设置与你的系统环境不匹配,但是从错误消息中很难说。

8yoxcaq7

8yoxcaq72#

这个问题发生在我从Ubuntu 16升级到Ubuntu 18.04 LTS之后。

gpg --version
gpg (GnuPG) 2.2.4

首先,我在非jenkins环境中使用

mvn install

我收到了消息

gpg: signing failed: Inappropriate ioctl for device

这让我想到
https://github.com/keybase/keybase-issues/issues/2798
以及
https://tutorials.technology/solved_errors/21-gpg-signing-failed-Inappropriate-ioctl-for-device.html

export GPG_TTY=$(tty)

是推荐的补救措施。我已经将此添加到我的.profile并重新启动

mvn install

测试。这一次我被要求通过终端输入OpenPGP密钥的密码短语。通过命令行的第二次运行成功,没有输入密钥。
然后我停下来重新启动Jenkins,再次尝试失败的作业。这一次成功了。
不幸的是,它仍然不能在jenkins jobx中工作,xsession是启动的。http://maven.apache.org/plugins/maven-gpg-plugin/usage.html明确指出,你可以把gpg.passphrase放在settings.xml中,我已经有效地使用了很长一段时间。知道我不知道如何恢复这种行为,我只能提供上面的变通办法。
另请参见Avoid gpg signing prompt when using Maven release plugin

zbdgwd5y

zbdgwd5y3#

这意味着你需要一个密匙来签署jar。只要按照this的过程直到最后一步(你不需要把它复制到github)
这里总结一下:
1.打开Git Bash

  1. gpg --gen-key #使用默认值4096作为密钥大小
  2. gpg --list-secret-keys --keyid-format LONG
    1.(可选)gpg --armor --export %the key from above%

相关问题