Maven Source Plugin

 项目pom文件build下添加配置:
01    <plugin>
02        <groupId>org.apache.maven.plugins</groupId>
03        <artifactId>maven-source-plugin</artifactId>
04        <version>2.2.1</version>
05        <executions>
06            <execution>
07                <id>attach-sources</id>
08                <goals>
09                    <goal>jar-no-fork<span></span></goal>
10                </goals>
11            </execution>
12        </executions>
13    </plugin>

execution下可配置phase属性, 意思是在什么阶段打包源文件。如<phase>package</phase>


    执行 mvn install,maven会自动将source install到repository 。
    执行 mvn deploy,maven会自动将source deploy到remote-repository 。
    执行 mvn source:jar,单独打包源码。

 

你可能感兴趣的:(plugin)