Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试使用maven使用GPG对文件进行自动签名时出错_Java_Maven_Maven Central_Gpg Signature_Maven Gpg Plugin - Fatal编程技术网

Java 尝试使用maven使用GPG对文件进行自动签名时出错

Java 尝试使用maven使用GPG对文件进行自动签名时出错,java,maven,maven-central,gpg-signature,maven-gpg-plugin,Java,Maven,Maven Central,Gpg Signature,Maven Gpg Plugin,我试图将我的项目部署到maven中央存储库,但无法解决错误:源代码验证的问题。 我已经安装了gpg,并完成了说明: 及 当我尝试运行清除部署-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.li

我试图将我的项目部署到maven中央存储库,但无法解决
错误:源代码验证的问题。
我已经安装了gpg,并完成了说明:
及

当我尝试运行
清除部署-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
在my
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>
但这没用


如何解决这个问题?

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

首先尝试将maven gpg插件升级到1.6版,现在我发现:
无法执行gpg命令:执行进程时出错。无法运行程序“gpg.exe”:CreateProcess error=2
,但这很奇怪,因为我已经安装了gpg4winTry,以便与
mvn-X…
一起运行,并将输出重定向到类似
mvn-X..>x、 登录
并尝试查看是否有与maven gpg插件相关的问题的更多信息…可能gpg.exe不在路径
上?问题是路径不正确,然后是默认公钥。现在它起作用了^_^
 <profiles>
     <profile>
         <id>ossrh</id>
         <activation>
             <activeByDefault>true</activeByDefault>
         </activation>
         <properties>
             <gpg.executable>gpg</gpg.executable>
             <gpg.passphrase></gpg.passphrase>
         </properties>
     </profile>
 </profiles>