gpt4 book ai didi

java - 尝试使用 Maven 使用 GPG 自动签署文件时出错

转载 作者:行者123 更新时间:2023-11-29 04:22:42 24 4
gpt4 key购买 nike

我正在尝试将我的项目部署到 Maven 中央存储库,但我无法解决 Error:Sources Validation 的问题。我已经安装了 gpg 并按照说明进行了操作: Adding a GPG keyApache Maven signed components

当我尝试运行 clear deploy -e 时,出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project tarantoolorm: Exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project tarantoolorm: Exit code: 1 at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at
org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at
java.lang.reflect.Method.invoke(Method.java:498) at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) at
org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.maven.plugin.MojoExecutionException: Exit code: 1 at
org.apache.maven.plugin.gpg.GpgSigner.generateSignatureForFile(GpgSigner.java:168) at
org.apache.maven.plugin.gpg.AbstractGpgSigner.generateSignatureForArtifact(AbstractGpgSigner.java:205) at
org.apache.maven.plugin.gpg.GpgSignAttachedMojo.execute(GpgSignAttachedMojo.java:140) at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 21 more

在我的 pom.xml 中我有下一个设置:

 <distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

此外,我在 settings.xml 中添加了一些属性:

 <profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase></gpg.passphrase>
</properties>
</profile>
</profiles>

但这并没有帮助。

我该如何解决这个问题?

最佳答案

我遇到了同样的问题,我使用了完整路径而不是“gpg” enter image description here

关于java - 尝试使用 Maven 使用 GPG 自动签署文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48130754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com