【问题标题】:Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project playerinputs: Exit code: 1 -> [Help 1]无法在项目 playerinputs 上执行目标 org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts):退出代码:1 -> [帮助 1]
【发布时间】:2020-09-26 10:16:01
【问题描述】:

我试图将我的第一个 api 上传到 maven 中心,但我继续收到此错误。我一直无法解决它。我正在运行mvn clean deploy 我读过运行mvn clean deploy -Dgpg.skip=true 可以工作,但它没有。我也读过这个帖子:stackoverflowgithub 但它不起作用 这是错误

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.411 s
[INFO] Finished at: 2020-06-07T14:15:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project playerinputs: Exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我检查了错误中链接的页面,但我不喜欢它

这是我的pom

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.MrNemo64</groupId>
    <artifactId>playerinputs</artifactId>
    <version>1.2</version>
    <name>PlayerInputs</name>
    <description>Useful clases to get player inputs in several ways</description>
    <url>https://github.com/MrNemo64/player-inputs</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Javier Rodríguez Pérez</name>
            <email>my.nemo_64.otravez@gmail.com</email>
            <organization>org.github.MrNemo64</organization>
            <organizationUrl>https://github.com/MrNemo64/player-inputs</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/MrNemo64/player-inputs.git</connection>
        <developerConnection>scm:git:ssh://github.com:MrNemo64/player-inputs.git</developerConnection>
        <url>https://github.com/MrNemo64/player-inputs</url>
    </scm>

    <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>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <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>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </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-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</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>
        </plugins>
    </build>

    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <!--This adds the Bukkit API artifact to the build -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.13.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency>
    </dependencies>
</project>

如果您需要更多信息,请告诉我,感谢您的帮助!

【问题讨论】:

    标签: maven deployment maven-central


    【解决方案1】:

    在某些情况下,如果您使用 gpg 插件对工件进行签名,您可能会收到以下错误并且构建将失败。

    [ERROR] 无法在项目 testng-parser 上执行目标 org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts):退出代码:2

    如果您收到上述错误,则有几种方法可以跳过工件签名并执行您的构建。

    方法 1:编辑你的 POM 您可以从 POM 禁用 gbp 插件或跳过工件的签名。请参考以下内容。

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <configuration>
            <skip>true</skip>
        </configuration>
    </plugin>
    

    方法 2:在运行时禁用 您还可以通过使用以下参数运行 mvn build 在运行时禁用 gpg 签名。

    mvn clean install -Dgpg.skip
    

    或作为

    mvn clean install -Dgpg.skip=true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 1970-01-01
      • 1970-01-01
      • 2016-07-25
      • 2018-03-04
      • 2016-08-06
      • 1970-01-01
      相关资源
      最近更新 更多