此规则强制所有插件都定义了一个版本,在 pom 或父 pom 的 plugin 或 pluginManagement 部分中。
此规则支持以下参数:
示例插件配置(显示一些默认值,可以跳过默认值):
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>enforce-plugin-versions</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requirePluginVersions> <message>Best Practice is to always define plugin versions!</message> <banLatest>true</banLatest> <banRelease>true</banRelease> <banSnapshots>true</banSnapshots> <phases>clean,deploy,site</phases> <additionalPlugins> <additionalPlugin>org.apache.maven.plugins:maven-eclipse-plugin</additionalPlugin> <additionalPlugin>org.apache.maven.plugins:maven-reactor-plugin</additionalPlugin> </additionalPlugins> <unCheckedPluginList>org.apache.maven.plugins:maven-enforcer-plugin,org.apache.maven.plugins:maven-idea-plugin</unCheckedPluginList> </requirePluginVersions> </rules> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project>