### 59.3. 默认排除规则 Gradle处理"exclude rules"的方式和Maven稍微有些不同,在使用starter POMs时这可能会引起无法预料的结果。特别地,当一个依赖可以通过不同的路径访问时,对该依赖声明的exclusions将不会生效。例如,如果一个starter POM声明以下内容: ```xml org.springframework spring-core 4.0.5.RELEASE commons-logging commons-logging org.springframework spring-context 4.0.5.RELEASE ``` `commons-logging` jar不会被Gradle排除,因为通过没有`exclusion`元素的`spring-context`可以传递性的拉取到它(spring-context → spring-core → commons-logging)。 为了确保正确的排除被实际应用,Spring Boot Gradle插件将自动添加排除规则。所有排除被定义在`spring-boot-dependencies` POM,并且针对"starter" POMs的隐式规则也会被添加。 如果不想自动应用排除规则,你可以使用以下配置: ```gradle springBoot { applyExcludeRules=false } ```