参考资料:
- 【enforcer首页】http://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html
- 【内置规则】http://maven.apache.org/enforcer/enforcer-rules/index.html
- 【codehaus扩展规则】http://www.mojohaus.org/extra-enforcer-rules/
- 不允许出现SNAPSHOT。
- 制定GAV规则。
- 不允许出现重复jar包
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<fail>true</fail>
<failFast>true</failFast>
<rules>
<requireReleaseDeps>
<failWhenParentIsSnapshot>false</failWhenParentIsSnapshot>
<message>No Snapshots Allowed!</message>
<excludes>
<exclude>com.imooc.harder:*</exclude>
</excludes>
</requireReleaseDeps>
<bannedDependencies>
<searchTransitive>true</searchTransitive>
<message>Dependecy Check Failed!</message>
<excludes>
<exclude>org.springframework:spring-beans:(,4.1.2.RELEASE]</exclude>
<exclude>commons-logging:commons-logging</exclude>
</excludes>
</bannedDependencies>
<banDuplicateClasses>
<ignoreClasses>
<ignoreClass>javax.*</ignoreClass>
<ignoreClass>org.apache.commons.logging.*</ignoreClass>
<ignoreClass>org.apache.shiro.*</ignoreClass>
<ignoreClass>org.objectweb.asm.*</ignoreClass>
<ignoreClass>shade.org.apache.commons.*</ignoreClass>
<ignoreClass>org.apache.commons.*</ignoreClass>
<ignoreClass>zander.com.google.common.*</ignoreClass>
<ignoreClass>zander.com.google.thirdparty.*</ignoreClass>
<ignoreClass>com.facebook.fb303.*</ignoreClass>
<ignoreClass>scribe.thrift.*</ignoreClass>
<ignoreClass>org.apache.thrift.*</ignoreClass>
<ignoreClass>org.aspectj.*</ignoreClass>
</ignoreClasses>
<findAllDuplicates>true</findAllDuplicates>
</banDuplicateClasses>
</rules>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.0-beta-6</version>
</dependency>
</dependencies>
</plugin>
点击查看更多内容
1人点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦