OSSRH "Missing signature" (gpg) on Central publish in CI
Maven Central rejects the staging repository because artifacts lack .asc GPG signatures. The maven-gpg-plugin either did not run in CI or had no key/passphrase, so unsigned files failed the validation rules.
What this error means
The staging repository fails to close with "Missing Signature" for each artifact, or the local build fails with "gpg: signing failed: No secret key" / "No pinentry".
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:sign
[ERROR] gpg: signing failed: No secret key
[ERROR] gpg: no default secret key: No secret keyCommon causes
No GPG key imported in the CI runner
The signing key is not present on the ephemeral runner, so maven-gpg-plugin has no secret key to sign with.
Missing passphrase or non-interactive gpg failure
gpg cannot prompt in CI; without --batch --pinentry-mode loopback and a passphrase, signing fails and artifacts stay unsigned.
How to fix it
Import the key and sign in batch mode
- Import the ASCII-armored private key from a secret into the runner keyring.
- Pass the passphrase to the gpg plugin in loopback mode.
- Re-run so every artifact gets a
.ascsignature.
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
mvn -Dgpg.passphrase="$GPG_PASSPHRASE" \
-Dgpg.pinentryMode=loopback deployConfigure the gpg plugin arguments
Force loopback pinentry so the plugin never tries to prompt on a headless runner.
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>How to prevent it
- Store the GPG private key and passphrase as CI secrets.
- Always run gpg in batch/loopback mode on headless runners.
- Verify a
.ascexists for each artifact before closing staging.