I am trying to add my school project to the maven repository. I am following this tutorial: https://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/. I already generated a key and passphrase successfully and I have added the plugin from that link to my pom file.
When I run command mvn clean deploy -Dgpg.passphrase=mypassphrase
it says
[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]
If I only run mvn clean deploy
it says
[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]
I tried to google this, but I was unable to find exactly the same problem. I am running this project on Windows 10.
Instead of using
maven-gpg-plugin
for signing you can try another plugin https://www.simplify4u.org/sign-maven-plugin/ which doesn't need external software likegpg
for signing.sign-maven-plugin
internally uses the Bouncy Castle library, so the signing process does not depend on the operating system.It also doesn't depend on conslole which you use, if you can run maven build - signing will work.