Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

This error is driving me crazy. Can someone please help me? I do have gpg installed and it is also in PATH. What is causing this error!!!

Am running this job on jenkins 1.5 , maven 3.0.3 on linux and windows ( both show same error)

[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
                Does it happen when you run mvn from command line on the Jenkins node? You should really add -e switch to see more logs
– Slav
                Aug 17, 2015 at 17:08
                i have the -e switch and the -X. This is the maximum information that it is logging. If I do a "build now" in Jenkins it builds fine. If I do a "perform maven release" in jenkins, thats when it fails.  My maven release build goals and options are -Dresume=false  release:clean release:prepare release:perform. I even tried a -Dgpg.skip=true but no difference
– user1164061
                Aug 17, 2015 at 17:20

If you don't need your artifacts to be signed, you may disable or skip the execution of the gpg plugin defined in the parent pom

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

or run the build with gpg.skip=true (see Maven GPG Plugin)

If you need your artifacts to be signed, you should either check the configuration of the gpg-plugin in the parent pom or override the configuration in your pom. Maybe some settings in the parent pom do not match your system's environment, but thats difficult to say from the error message.

My maven release build goals and options are -Dresume=false release:clean release:prepare release:perform. I even tried a -Dgpg.skip=true but no difference . – user1164061 Aug 25, 2015 at 17:35 Thanks, that helped me a lot.. been looking for solution to this problem the quickest answer was to add <configuration> <skip>true</skip> </configuration> to the XML – asmgx Nov 17, 2020 at 5:06 Same issue as @user1164061, -Dgpg.skip=true has no effect. sign still getting triggered. I can't figure out how to disable this plugin which I'm inheriting from a parent pom from another project. – buzz3791 Nov 17, 2021 at 19:59

The issue happened to me after upgrading from Ubuntu 16 to Ubuntu 18.04 LTS in nightly jenkins build.

gpg --version
gpg (GnuPG) 2.2.4

First i checked the same project in a non jenkins environment with

mvn install

and I got the message

gpg: signing failed: Inappropriate ioctl for device

which pointed me to

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)

is the recommended remedy there. I have added this to my .profile and restarted the

mvn install 

test. This time i was asked to enter the passphrase for OpenPGP secret key via the terminal. A second run via the command line was successful without entering the key.

I then stopped and restarted jenkins and tried the failing job again. This time it worked.

Unfortunately it still does not work in jenkins jobx where an xsession is started. http://maven.apache.org/plugins/maven-gpg-plugin/usage.html explictly states that you can put the gpg.passphrase in a settings.xml which I have been using effectively for a long time. Know i do not know how do get this behavior back I only can offer the workaround above.

See also Avoid gpg signing prompt when using Maven release plugin

This means that you need to have a key to sign the jars. Just follow this process until the last step (you dont need to copy it to github oviously)

Here a summary:

  • Open Git Bash
  • gpg --gen-key #use defaults with 4096 as key size
  • gpg --list-secret-keys --keyid-format LONG
  • (optional) gpg --armor --export %the key from above%
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.