I'm trying to deploy my local artifact into the nexus staging repository but the task is failing with the below error.
gpg: no default secret key: No secret key
gpg: signing failed: No secret key
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.886 s
[INFO] Finished at: 2021-06-14T14:12:29+05:30
[INFO] -----------------------------------------
Steps I followed.
- I have installed the
gpg
using brew. - gpg version is
gpg (GnuPG) 2.3.1 libgcrypt 1.9.3
- I have added the setting.xml to
.m2
directory path -~/.m2/settings.xml
- Here is the my
settings.xml file
<settings>
<servers>
<server>
<id>ossrh</id>
<username>$name</username>
<password>$password</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>$passphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
I have imported the
.asc
file usinggpg --import file.asc
when I run
gpg --list-keys
command, I'm able to see thepub
,uid
&sub
key values.My current mvn version is
Apache Maven 3.6.3
I have updated my project module pom.xml with the below values
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Can you please someone help what's wrong with my configuration? Why I am getting the no default secret key: No secret key
error?
I have referred this issue but still no luck