【问题标题】:Maven GPG plugin not signing sources and javadoc jarsMaven GPG 插件未签名源和 javadoc jar
【发布时间】:2013-02-01 22:13:41
【问题描述】:

我正在尝试使用 Maven 将项目的工件发布到 Sonatype。我正在使用 Maven GPG 插件对工件进行签名,但它没有对 Sonatype 所需的源代码和 javadoc jar(只是主 jar)进行签名。以下是我认为 pom.xml 的相关部分:

<plugins>
    ...
    <plugin>
        <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <phase>install</phase>
                    <goals>
                        <goal>jar-no-fork</goal>
                    </goals>
                </execution>
            </executions>
    </plugin>
    <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
            <execution>
                <id>attach-javadocs</id>
                <phase>install</phase>
                <goals>
                    <goal>jar</goal>
                </goals>
                </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <executions>
            <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                    <goal>sign</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    ...
</plugins>

有没有办法告诉它也签署这些其他罐子?

【问题讨论】:

    标签: java maven pom.xml gnupg sonatype


    【解决方案1】:

    对 pom 的这些更改解决了问题:

    <plugins>
        ...
        <plugin>
            <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
        </plugin>
        <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <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.4</version>
            <executions>
                <execution>
                    <id>sign-artifacts</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        ...
    </plugins>
    

    【讨论】:

    • 所以,简而言之:删除文档和源插件的阶段。
    • 您好,您能解释一下为什么会出现问题吗?
    • 感谢您在这里分享。我有一个类似的问题,这是一个订单问题。 attach-sources、attach-javadoc 和 maven-gpg-plugin 都被定义为在验证阶段运行。我已将attach-* 任务移至package 阶段,它对我来说效果很好。
    猜你喜欢
    • 2014-09-08
    • 1970-01-01
    • 2022-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-02
    • 1970-01-01
    • 2023-04-03
    相关资源
    最近更新 更多