当前位置: 代码迷 >> J2EE >> 怎么让maven-source-plugin只是在install、deploy的才生成源码
  详细解决方案

怎么让maven-source-plugin只是在install、deploy的才生成源码

热度:79   发布时间:2016-04-17 22:57:12.0
如何让maven-source-plugin只是在install、deploy的才生成源码
我想在Install,deploy的时候,打包源码

于是,加入了如下配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <phase>install</phase>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

然后,执行mvn clean install
发现本地仓库并没有源码

把上面的<phase>install</phase> 改成  <phase>compile</phase>倒是可以。但是,package的时候,也打了源码包了。很不爽

请问,如何解决这个问题
------解决思路----------------------
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>jar-no-fork</goal>
            </goals>
        </execution>
    </executions>
</plugin>
然后,mvn install 就可以生成源代码,package不会生成源代码
  相关解决方案