<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Maven GPG Plugin &#8211; My Shitty Code</title>
	<atom:link href="https://myshittycode.com/tag/maven-gpg-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>https://myshittycode.com</link>
	<description>Embracing the Messiness in Search of Epic Solutions</description>
	<lastBuildDate>Fri, 06 Jan 2023 16:25:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://myshittycode.com/wp-content/uploads/2022/04/cropped-icon-32x32.png</url>
	<title>Maven GPG Plugin &#8211; My Shitty Code</title>
	<link>https://myshittycode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">205304208</site>	<item>
		<title>Maven GPG Plugin: Prevent Signing Prompt or &#8220;gpg: signing failed: No such file or directory&#8221; Error</title>
		<link>https://myshittycode.com/2017/08/07/maven-gpg-plugin-prevent-signing-prompt-or-gpg-signing-failed-no-such-file-or-directory-error/</link>
					<comments>https://myshittycode.com/2017/08/07/maven-gpg-plugin-prevent-signing-prompt-or-gpg-signing-failed-no-such-file-or-directory-error/#comments</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Mon, 07 Aug 2017 20:09:22 +0000</pubDate>
				<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Maven GPG Plugin]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=1056</guid>

					<description><![CDATA[<p>PROBLEM Given the following Maven settings.xml:- &#8230; and the following Maven GPG Plugin configuration in pom.xml:- When running mvn clean deploy, you either get a prompt for you to enter the GPG passphrase:- &#8230; or, get the following error:- The long story short, Maven GPG Plugin isn&#8217;t using the passphrase defined in the Maven settings.xml&#8230; [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2017/08/07/maven-gpg-plugin-prevent-signing-prompt-or-gpg-signing-failed-no-such-file-or-directory-error/">Maven GPG Plugin: Prevent Signing Prompt or &#8220;gpg: signing failed: No such file or directory&#8221; Error</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>Given the following Maven <code>settings.xml</code>:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;settings&gt;
	&lt;profiles&gt;
		&lt;profile&gt;
			&lt;activation&gt;
				&lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
			&lt;/activation&gt;
			&lt;properties&gt;
				&lt;gpg.executable&gt;/usr/local/bin/gpg&lt;/gpg.executable&gt;
				&lt;gpg.passphrase&gt;XXXXXXXXXXXXXXXXXX&lt;/gpg.passphrase&gt;
			&lt;/properties&gt;
		&lt;/profile&gt;
	&lt;/profiles&gt;
&lt;/settings&gt;
</pre></div>


<p>&#8230; and the following Maven GPG Plugin configuration in <code>pom.xml</code>:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-gpg-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.6&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;sign-artifacts&lt;/id&gt;
            &lt;phase&gt;verify&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;sign&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</pre></div>


<p>When running <code>mvn clean deploy</code>, you either get a prompt for you to enter the GPG passphrase:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
┌────────────────────────────────────────────────────────────────┐
│ Please enter the passphrase to unlock the OpenPGP secret key:  │
│ &quot;Shitty Author &amp;lt;shitty@email.com&gt;&quot;                             │
│ 2048-bit RSA key, ID 9F1A27DFE94D5473,                         │
│ created 2015-05-08.                                            │
│                                                                │
│                                                                │
│ Passphrase: __________________________________________________ │
│                                                                │
│         &amp;lt;OK&gt;                                    &amp;lt;Cancel&gt;       │
└────────────────────────────────────────────────────────────────┘

</pre></div>


<p>&#8230; or, get the following error:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
gpg: signing failed: No such file or directory
</pre></div>


<p>The long story short, Maven GPG Plugin isn&#8217;t using the passphrase defined in the Maven <code>settings.xml</code>&#8230; AND THIS UPSETS THE HONEY BADGER!</p>



<h2 class="wp-block-heading">SOLUTION</h2>



<p>If you 1) initially had it working in the past, and 2) have tried all sorts of solutions from the web, and still couldn&#8217;t get it working, chances are you have unconsciously upgraded GPG version from 2.0 to 2.1.</p>



<p>You can check your GPG version by running the following command:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [1]; title: ; notranslate">
✗ gpg --version
gpg (GnuPG) 2.1.21
libgcrypt 1.7.6
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &amp;lt;https://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /Users/shitty-author/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
</pre></div>


<p>To fix this, GPG 2.1 requires <code>--pinentry-mode</code> to be set to <code>loopback</code> in order to pick up <code>gpg.passphrase</code> value defined in Maven <code>settings.xml</code>.</p>



<p>So, update Maven GPG Plugin configuration in <code>pom.xml</code> to the following:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [12,13,14,15,16,17]; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-gpg-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.6&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;sign-artifacts&lt;/id&gt;
            &lt;phase&gt;verify&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;sign&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;gpgArguments&gt;
                    &lt;arg&gt;--pinentry-mode&lt;/arg&gt;
                    &lt;arg&gt;loopback&lt;/arg&gt;
                &lt;/gpgArguments&gt;
            &lt;/configuration&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</pre></div>


<p>When re-running <code>mvn clean deploy</code>, it should deploy the artifact properly now.</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2017/08/07/maven-gpg-plugin-prevent-signing-prompt-or-gpg-signing-failed-no-such-file-or-directory-error/">Maven GPG Plugin: Prevent Signing Prompt or &#8220;gpg: signing failed: No such file or directory&#8221; Error</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2017/08/07/maven-gpg-plugin-prevent-signing-prompt-or-gpg-signing-failed-no-such-file-or-directory-error/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1056</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching using Disk

Served from: myshittycode.com @ 2026-02-26 20:03:44 by W3 Total Cache
-->