Maven Release Plugin部署sources.jar和javadoc.jar

发布于 2024-10-12 16:37:10 字数 171 浏览 10 评论 0原文

我使用 Maven 发布插件来生成项目的发布版本。我不想在构建时一直生成 Javadoc。另一方面,当我调用release:perform时,我希望maven是否会生成sources.jar和javadoc.jar并将其部署到maven发布存储库。只是因为我很好奇如何禁用部署 source.jar,因为它看起来像是默认部署的。

I use maven release plugin for generating release of my project. I do not want to generate Javadoc all time I build. On the other hand when I call release:perform I would like if maven would generate sources.jar and javadoc.jar and would deploy it to maven release repository. Just because I am curious how deploying source.jar can be disabled, since It looks like it is deployed by default.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云朵有点甜 2024-10-19 16:37:10

Maven Release Plugin 的文档中,有一个useReleaseProfile 参数,该参数确定是否使用将源代码和 javadoc 添加到已发布工件的发布配置文件(如果适用)。默认情况下这是true。您可以尝试根据情况更改此设置以启用/禁用 source/javadocs。

From the documentation of Maven Release Plugin, there is a useReleaseProfile parameter, which determines Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. This is true by default. You can try changing this as appropriate to enable/disable source/javadocs.

爱她像谁 2024-10-19 16:37:10

使用 releaseProfiles 参数(示例:src,javadoc) 打开一个或多个配置文件,并在这些配置文件中定义源和 javadoc 生成:

<profiles>
    <profile>
        <id>src</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>javadoc</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.7</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Use the releaseProfiles parameter (example: src,javadoc) to turn on one or more profiles, and in these profiles, define the source and javadoc generation:

<profiles>
    <profile>
        <id>src</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>javadoc</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.7</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文