你可以使用
maven-enforcer-plugin来禁止一些依赖.
以下是他们排除Apache Commons Logging更新的示例.
[...]
org.apache.maven.plugins
maven-enforcer-plugin
1.1.1
enforce-banned-dependencies
enforce
commons-logging:commons-logging
true
[...]
运行mvn安装时的输出将是:
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
Found Banned Dependency: commons-logging:commons-logging:jar:1.1.1
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
它都以BUILD FAILURE结束.