@@ -261,6 +261,56 @@ to override version numbers if necessary.
261
261
262
262
263
263
264
+ [[build-tool-plugins-gradle-exclude-rules]]
265
+ === Default exclude rules
266
+ Gradle handles ``exclude rules'' in a slightly different way to Maven which can cause
267
+ unexpected results when using the starter POMs. Specifically, exclusions declared on
268
+ a dependency will not be applied when the dependency can be reached though a different
269
+ path. For example, if a starter POM declares the following:
270
+
271
+ [source,xml,indent=0,subs="verbatim,attributes"]
272
+ ----
273
+ <dependencies>
274
+ <dependency>
275
+ <groupId>org.springframework</groupId>
276
+ <artifactId>spring-core</artifactId>
277
+ <version>4.0.5.RELEASE</version>
278
+ <exclusions>
279
+ <exclusion>
280
+ <groupId>commons-logging</groupId>
281
+ <artifactId>commons-logging</artifactId>
282
+ </exclusion>
283
+ </exclusions>
284
+ </dependency>
285
+ <dependency>
286
+ <groupId>org.springframework</groupId>
287
+ <artifactId>spring-context</artifactId>
288
+ <version>4.0.5.RELEASE</version>
289
+ </dependency>
290
+ </dependencies>
291
+ ----
292
+
293
+ The `commons-logging` jar will *not* be excluded by Gradle because it is pulled in
294
+ transitively via `spring-context` (`spring-context` -> `spring-core` -> `commons-logging`)
295
+ which does not have an `exclusion` element.
296
+
297
+ To ensure that correct exclusions are actually applied, the Spring Boot Gradle plugin will
298
+ automatically add exclusion rules. All exclusions defined in the
299
+ `spring-boot-dependencies` POM and the ``starter'' POMs will be added (both direct and
300
+ transitive exclusions).
301
+
302
+ If you don't want exclusion rules automatically applied you can use the following
303
+ configuration:
304
+
305
+ [source,groovy,indent=0,subs="verbatim,attributes"]
306
+ ----
307
+ springBoot {
308
+ applyExcludeRules=false
309
+ }
310
+ ----
311
+
312
+
313
+
264
314
[[build-tool-plugins-gradle-packaging]]
265
315
=== Packaging executable jar and war files
266
316
Once the `spring-boot` plugin has been applied to your project it will automatically
0 commit comments