您可以使用禁止某些依赖项
maven-enforcer-plugin。
这是他们的示例,其中包含将您排除Apache Commons Logging的更新。
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <id>enforce-banned-dependencies</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <bannedDependencies> <excludes> <exclude>commons-logging:commons-logging</exclude> </excludes> </bannedDependencies> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> </plugins> </build> [...]</project>
运行时的输出
mvn install将是:
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:Found Banned Dependency: commons-logging:commons-logging:jar:1.1.1Use 'mvn dependency:tree' to locate the source of the banned dependencies.
一切都以结尾
BUILD FAILURE。



