Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Fedora: maven-gpg-plugin keep asking passphrase

When doing maven release, maven-gpg-plugin keep showing

請輸入密語: [INFO] gpg: gpg-agent 在此階段無法使用
Enter passphrase: [INFO] gpg: gpg-agent is not available in this session

I literately has to input passphrase dozens (if not hundreds) times. Indeed annoying.

This is because Bug: gpg-1 cannot locate gpg-agent >= 2.1 . But I don’t really want to wait for the package fix. Luckily, gpg2 works, and there is a way to change what maven-gpg-plugin invokes. In other words. add following sections to your ~/.m2/settings.xml

<settings>
  <profiles>
    <profile>
      <id>gpg</id>
      <properties>
        <gpg.executable>gpg2</gpg.executable>
<!-- No need to enter passphrase here, gpg-agent should be working now
        <gpg.passphrase>mypassphrase</gpg.passphrase>
-->
      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>gpg</activeProfile>
  </activeProfiles>
</settings>

Note that RHEL 7 does not suffer this problem, as in RHEL 7, gpg is actually gpg2. You can use

gpg --version

to verify it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: