簡體   English   中英

source.jar和javadoc.jar的Maven Release Plugin部署

[英]Maven Release Plugin deployment of sources.jar and javadoc.jar

我使用maven發布插件來生成我的項目的發布。 我不想在構建時生成Javadoc。 另一方面,當我調用release:perform時,我想如果maven會生成sources.jar和javadoc.jar並將其部署到maven發布存儲庫。 僅僅因為我很好奇如何禁用部署source.jar,因為它看起來默認是部署的。

Maven Release Plugin的文檔中,有一個useReleaseProfile參數,該參數確定Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate 默認情況下這是true 您可以嘗試更改此選項以啟用/禁用source / javadocs。

使用releaseProfiles參數(例如: src,javadoc )打開一個或多個配置文件,在這些配置文件中,定義source和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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM