Skip to Content

Using the maven release plugin with gpg-agent

When creating releases using the maven release and the pgp plugin you are asked to sign your release. Due to an annoying bug in the release plugin you’ll never see the prompt and mvn will just hang. One way to get around this is to use the gpg-agent and to trigger gpg action before building the release so that gpg-agent will cache your passphrase (at least for some time).

$ touch /tmp/foo.txt
$ gpg --armor --sign /tmp/foo.txt

You need a passphrase to unlock the secret key for
user: "Christian Egli <christian.egli@sbs.ch>"
1024-bit DSA key, ID 20241053, created 2008-08-13

Enter passphrase:
$

Now gpg-agent will cache your passphrase and if you configure your pgp plugin to use an agent (<useAgent>true</useAgent>) then it will not ask you for a passphrase.

Update

Well, this is embarassing: gpg-agent should really cache your passphrase when you start your session. Above triggering seems to be due to the fact that I didn’t have gpg-agent installed. Doh!