Maven Enforcer Plugin 定义一些必须遵守的配置
你如果想再maven中定义一些配置,这些配置需要整个团队遵守,比如定义maven版本,java版本,os配置,文件系统的配置,或者你想扩展的任何配置,那么就可以使用Maven Enforcer Plugin这个maven插件。
?
pom中引入Maven Enforcer Plugin插件。
?
?
alwaysPass - Always passes... used to test plugin configuration.alwaysFail - Always fail... used to test plugin configuration.bannedDependencies - enforces that excluded dependencies aren't included.bannedPlugins - enforces that excluded plugins aren't included.dependencyConvergence - ensure all dependencies converge to the same version.evaluateBeanshell - evaluates a beanshell script.requireReleaseDeps - enforces that no snapshots are included as dependencies.requireReleaseVersion - enforces that the artifact is not a snapshot.requireMavenVersion - enforces the Maven version.requireJavaVersion - enforces the JDK version.requireOS - enforces the OS / CPU Archictecture.requirePluginVersions - enforces that all plugins have a specified version.requireProperty - enforces the existence and values of properties.requireFilesDontExist - enforces that the list of files do not exist.requireFilesExist - enforces that the list of files do exist.requireFilesSize - enforces that the list of files exist and are within a certain size range.
?可以参考:http://maven.apache.org/enforcer/enforcer-rules/index.html
?
当然你可以扩展自定义的规则:http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html
?
?
?
还有一篇文章可以参考:http://www.juvenxu.com/2010/07/30/you-have-to-follow-convention-maven-enforcer-plugin/