如何让maven-source-plugin只在install、deploy生成源码

J2EE 码拜 9年前 (2015-11-08) 1808次浏览
本人想在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的时候,也打了源码包了。
怎么样解决这个问题
解决方案:20分
<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不会生成源代码

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明如何让maven-source-plugin只在install、deploy生成源码
喜欢 (0)
[1034331897@qq.com]
分享 (0)