Excluding dependencies from a repackaged JAR using <excludes>
should exclude transitive dependencies as well.
For more context, this is from the hidden comment (https://github.com/spring-projects/spring-boot/issues/13289#issuecomment-674882306) marked as off-topic in #13289:
The following hidden comments (https://github.com/spring-projects/spring-boot/issues/13289#issuecomment-498153907, https://github.com/spring-projects/spring-boot/issues/13289#issuecomment-519075075) marked as off-topic seems to be very informative and vital for those who would like to exclude
provided
-scoped dependencies as a workaround.@brianwhu
exclude
works for single dependency only; any transitive still packagedBad news:
<excludes>
excludes only a specific artifact, but includes all its transitive dependencies!I do not understand why someone has hidden such helpful information as off-topic, but I hope this comment does not get hidden as well. If I were the repo maintainer, I would not hide them.
For example, in #13289, the issue talks about the Spring Boot plugin behavior that includes provided
-scoped dependencies in the repackaged JAR (not that this is a problem). As a workaround, one can use <excludes>
to exclude these dependencies, for example. However, it is counter-intuitive that it still packages all the transitive dependencies.
Comment From: snicoll
Thanks for the report but this is the documented behaviour for now and there is already an issue to revisit the situation.
Duplicate of #16563