Renew Expired GPG Keys for Maven Deployments with Spring Boot

This guide walks through diagnosing GPG signing failures caused by expired keys during a swagger‑spring‑boot‑starter release, shows how to inspect the current keyring, edit the key, extend its validity, and finally re‑run Maven deploy to publish artifacts.

Programmer DD
Programmer DD
Programmer DD
Renew Expired GPG Keys for Maven Deployments with Spring Boot

While publishing a project that uses swagger-spring-boot-starter, a GPG signing error occurs because the signing key has expired. The console shows warnings such as:

*gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect
gpg: no default secret key: No secret key
gpg: signing failed: No secret key

First, check the current keyring to confirm the key status: $ gpg --list-keys The output reveals that the primary RSA2048 key created in 2017 expired in December 2019, and the associated subkey is also expired.

Step 1: Edit the expired key $ gpg --edit-key xxxxxxxxxxxxxxx After entering the edit mode, the key information is displayed, confirming the expiration dates.

Step 2: Extend the expiration date

gpg> expire
# Choose the new validity period (e.g., 0 for never expires)
# Confirm the change with y

The command updates both the primary key and the subkey to “never expires”. The updated key details now show:

sec  rsa2048/aaaaaaaaaaaaaaaa
    created: 2017-12-05  expires: never   usage: SC
ssb  rsa2048/bbbbbbbbbbbbbbbb
    created: 2017-12-05  expires: never   usage: E

Finally, save the changes: gpg> save With the renewed key, the Maven deploy command can be executed again to publish the artifact to the central repository.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

mavenSpring BootSecurityKey ExpirationGPG
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.