I'm using spring-boot-maven-plugin to repackage my archive into a bootable and deployable WAR file. Doing so, I had to exclude few dependencies (transitive in my case). I tried excluding using exclusion configuration as mentioned in plugin documentation (https://docs.spring.io/spring-boot/docs/2.1.2.RELEASE/maven-plugin/examples/exclude-dependency.html). But it doesn't works. The dependencies I configure to exclude appears in the generated WAR file.
Plugin version: 2.1.2.RELEASE
Unfortunately I don't have a code snippet to post. I'll try to add later. Is this a known issue ?
Comment From: snicoll
@rvijayarajan "it does not work" is not very helpful. As you've figured out yourself, the link describes what should be done to exclude a dependency. If that does not work for you we'll need a sample that we can run ourselves.
Comment From: rvijayarajan
@snicoll I've created a sample project with my use case and pushed the same into github. You can checkout this code and do a "mvn clean install" to experience the case I've mentioned.
Github sample project URL: https://github.com/rvijayarajan/spring-boot-maven-plugin-exclude-test
In this sample project I've excluded a dependency with group and artifactId namely org.webjars and bootstrap respectively. But I see that in the generated spring-boot.war, the excluded dependency is still present.
Please let me know if I have to provide more details. Thanks.
Comment From: snicoll
Thank you for the sample. Have you noticed the repackage goal is invoked twice? Please check the release notes.
Regardless of this, this works fine with jar
packaging but does not for a war so we'll have to investigate what's wrong there.
Comment From: andrejleitner
Exclusions don't work for WAR packaging also in 2.0.8.RELEASE.
Comment From: snicoll
@andrejleitner I am aware of that. The 2.1.x
branch has superseded the 2.0.x
branch.
Comment From: rvijayarajan
Thanks @snicoll.
Comment From: nosan
@snicoll I have an idea how to fix this bug, don't you mind if I take this issue?
Comment From: snicoll
Thanks for the offer. I haven't had the time to look at it yet so I am happy to review a PR.
Comment From: snicoll
Closing in favour of PR #15947
Comment From: logicatmidod
Hi I am new to the contributors list trying to learn. Saw this is reopened again is there any reason why ?
Comment From: snicoll
@logicatmidod it was reopened because the PR it was closed in favor of was declined.
Comment From: ilam-natarajan
@philwebb any chance of this getting prioritised?
Comment From: philwebb
@ilam-natarajan It's already been triaged as bug in 2.3.x, but I'm afraid we haven't found time to fix it yet.
Comment From: wilkinsona
A discussion on Gitter with @filiphr reminded me that this also affects the automatic exclusion of starter and annotation-processor dependencies based on their Spring-Boot-Jar-Type
manifest header. I think that's because it uses the same underlying exclusion mechanism in AbstractDependencyFilterMojo
.