【发布时间】:2021-08-30 04:45:04
【问题描述】:
我正在尝试将我的本地工件部署到 nexus 暂存存储库中,但任务失败并出现以下错误。
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] -----------------------------------------
我遵循的步骤。
- 我已经使用 brew 安装了
gpg。 - gpg 版本为
gpg (GnuPG) 2.3.1 libgcrypt 1.9.3 - 我已将setting.xml 添加到
.m2目录路径-~/.m2/settings.xml - 这是我的
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>
-
我已经使用
gpg --import file.asc导入了.asc文件 -
当我运行
gpg --list-keys命令时,我可以看到pub、uid和sub键值。 -
我目前的mvn版本是
Apache Maven 3.6.3 -
我已使用以下值更新了我的项目模块 pom.xml
<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>
您能否请人帮助我的配置有什么问题?为什么我收到 no default secret key: No secret key 错误?
我已经提到了这个问题,但仍然没有运气
【问题讨论】:
-
您是否真的启用了
ossrh个人资料?当您尝试使用-P ossrh时会发生什么? -
@KarolDowbecki -P 表示什么?我应该尝试使用
mvn -P吗?可以举个例子吗 -
mvn clean deploy -P release我试过这个命令。我看到的仍然是同样的错误 -
密钥无法读取的原因可能是什么?我的所有步骤都正确吗?我错过了什么吗?
标签: java maven nexus gnupg artifact