Spring boot version: 2.4.5 (same version of gradle plugin)
The spring boot generated war file has some spring classes in the war's root which is public by default. When deployed on tomcat, I am able to download these classes. Shouldn't these classes go in the WEB-INF/classes?
Also, It seems these classes are for making the war "executable" using java -jar warname.war
like a jar file. I don't need that. Is there any way to disable making the war executable like jar?
How do I get rid of these class files from the generated war apart from manually deleting it or moving them into WEB-INF/classes?
Comment From: wilkinsona
Shouldn't these classes go in the WEB-INF/classes?
They need to be in the root of the war file so that they can be found when it is run using java -jar
.
I don't need that. Is there any way to disable making the war executable like jar?
If you don't want your war file to be executable then you should build it using the war
task rather than the bootWar
task. You may want to either just use Spring Boot's dependency management or you may want to re-enable the war
task and disable the bootWar
task:
war {
enabled = true
}
bootWar {
enabled = false
}
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.