I am using Maven 3.3.3 and Github SCM to release a jar to Sonatype. I am able to run
mvn clean deploy -Dgpg.passphrase=xxxxxx
mvn release:clean -Dgpg.passphrase=xxxxxx
But on running 'mvn release:prepare -Dgpg.passphrase=xxxxxx' I am getting a maven-release-plugin error with the following error message
2015-08-21 00:20:52,839 ERROR org.apache.maven.cli.MavenCli: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project symphony: Maven execution failed, exit code: '1' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project symphony: Maven execution failed, exit code: '1'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) [maven-embedder-3.3.3.jar:3.3.3]
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) [maven-embedder-3.3.3.jar:3.3.3]
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) [maven-embedder-3.3.3.jar:3.3.3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) [plexus-classworlds-2.5.2.jar:na]
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [plexus-classworlds-2.5.2.jar:na]
Caused by: org.apache.maven.plugin.MojoExecutionException: Maven execution failed, exit code: '1'
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:290) ~[na:na]
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:240) ~[na:na]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ~[maven-core-3.3.3.jar:3.3.3]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ~[maven-core-3.3.3.jar:3.3.3]
... 20 common frames omitted
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:91) ~[na:na]
at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.execute(RunPrepareGoalsPhase.java:44) ~[na:na]
at org.apache.maven.shared.release.phase.RunPrepareGoalsPhase.simulate(RunPrepareGoalsPhase.java:57) ~[na:na]
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:228) ~[na:na]
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169) ~[na:na]
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146) ~[na:na]
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107) ~[na:na]
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:286) ~[na:na]
... 23 common frames omitted
Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: '1'
at org.apache.maven.shared.release.exec.ForkedMavenExecutor.executeGoals(ForkedMavenExecutor.java:151) ~[na:na]
at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals(AbstractMavenExecutor.java:114) ~[na:na]
at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:85) ~[na:na]
... 30 common frames omitted
Following are the relevant sections of the pom file
<scm>
<connection>scm:git:[email protected]:eveningsamurai/symphony.git</connection>
<developerConnection>scm:git:[email protected]:eveningsamurai/symphony.git</developerConnection>
<url>[email protected]:eveningsamurai/symphony.git</url>
</scm>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</dependency>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<tagNameFormat>v0.1</tagNameFormat>
</configuration>
</plugin>
....
</build>
I have done the requisite Google + SO search but found nothing useful. I feel like there is a version mismatch somewhere but unable to figure out. Any ideas?
I was able to figure out the issue with using the -X option in the command line. It was complaining about "Cannot obtain passphrase in batch mode". I was able to fix it by moving the signing process in the pom within a profile and activating the profile only for the deploy goal.