Spring Boot gradle/maven plugin: bootRun produces massively long classpath entries
mmoayyed opened this issue · 2 comments
Howdy Spring Boot,
Per the guidelines here, I made the following post available on SO but given lack of response, I suspect it's got more serious causes.
Could you please review this bug report:
- http://stackoverflow.com/questions/41736562/spring-boot-maven-gradle-plugin-bootrun-task-generates-very-long-classpath
- https://github.com/apereo/cas/issues/2334
I have not found a reasonable workaround. Did not duplicate the text/issue description here as I think SO should describe things correctly but if there is anything I can help clarify, please let me know.
Note that this issue persists with 1.5.1 as well, and is apparent on both mac and windows platforms. It may also be related to the specific "overlay" nature of the sample project.
You're not using bootRun
as intended, and the fact that it works when you only have a single war dependency is by luck rather than by design.
bootRun
is intended to run the application in the current project but your cas
project doesn't directly contain an application. Instead, it depends on cas-server-webapp
which is an executable war file. Launching it is only successful because you've set mainClass
to org.springframework.boot.loader.WarLauncher
which is in the executable war. This results in the creation of a custom class loader than can load classes from WEB-INF/classes
and all of the jars in WEB-INF/lib
.
When you add an additional dependency, they're all added to bootRun's class path and are visible to the system class loader. You now have two copies of many of the application's classes available at the same time. Those on Boot's custom class loader in WEB-INF/classes
and jars in WEB-INF/lib
and those on the class path of the system class loader. All bets are off at this point.
It's not really clear to me what you're trying to do, but it is clear that you shouldn't be using bootRun
in the way that you are as it's not intended for running an already-built, executable jar or war.
If you'd like some more help, please feel free to chat on Gitter or to ask another question on Stack Overflow that takes into account the explanation above.
Thank you Andy. I'll review and may be in touch via gitter.