Q. How to get a deployable WAR on a standalone Tomcat with Spring Boot ?
Several steps are needed :
- In the pom of the web application, the packaging must be set to war such as <packaging>war</packaging>
- In the pom of the web application, you must exclude a Maven transitive dependency from the war packaging.
org.springframework.boot:spring-boot-starter-web pulls the org.springframework.boot:spring-boot-starter-tomcat dependency.
But if we have a standalone tomcat, we don’t want that the spring-boot-starter-tomcat dependency may create conflicts with classes from Tomcat.
So you must specify provided as scope for spring-boot-starter-tomcat artifact :<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
in progress…
Maybe, I forget something. Don’t hesitate to do a feedback in order that I adjust that.