尝试使用maven

时间:2018-01-06 18:55:35

标签: java maven maven-central gpg-signature maven-gpg-plugin

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

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

  

[错误]无法执行目标   org.apache.maven.plugins:maven-gpg-plugin:1.5:sign(sign-artifacts)on   project tarantoolorm:退出代码:1 - > [帮助1]   org.apache.maven.lifecycle.LifecycleExecutionException:失败   执行目标org.apache.maven.plugins:maven-gpg-plugin:1.5:签名   项目tarantoolorm上的(sign-artifacts):退出代码:1 at   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)     在   org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)     在   org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)     在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)at at   org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)at at   org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)at   org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)at at   org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)at at   org.apache.maven.cli.MavenCli.main(MavenCli.java:199)at at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)at   org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)     在   org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)     在   org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)     在   org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)     在org.codehaus.classworlds.Launcher.main(Launcher.java:47)引起   by:org.apache.maven.plugin.MojoExecutionException:退出代码:1 at   org.apache.maven.plugin.gpg.GpgSigner.generateSignatureForFile(GpgSigner.java:168)     在   org.apache.maven.plugin.gpg.AbstractGpgSigner.generateSignatureForArtifact(AbstractGpgSigner.java:205)     在   org.apache.maven.plugin.gpg.GpgSignAttachedMojo.execute(GpgSignAttachedMojo.java:140)     在   org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)     ......还有21个

在我的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>

但它没有帮助。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

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