maven 打包时将 source 和 javadoc 一起打包

在需要配置的项目 pom.xml 文件的模块

<build>
    <plugins>
    
    </plugins>
</build>

添加maven-source-pluginmaven-javadoc-plugin插件,其中3.0.12.10.4就是其版本:

            <!--配置生成Javadoc包-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <configuration>
                   <!--指定编码为UTF-8-->
                    <encoding>UTF-8</encoding>
                    <aggregate>true</aggregate>
                    <charset>UTF-8</charset>
                    <docencoding>UTF-8</docencoding>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--配置生成源码包-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

DC_ing
41 声望4 粉丝

IT农民工


引用和评论

0 条评论