How to set up Spring Boot 1.2.0 for Servlet 3.0 and install m2e Eclipse Facet on 3.0?

With Spring Boot 1.2.0, m2e installs the Eclipse Dynamic Web Project facet to 3.1. Servlet Spec 3.1 is expected to be supported again as Spring Boot 1.2.0.

However, we need to stop with 3.0 (Tomcat 7), so we set the correct property in our POM according to the download instructions:

<servlet-api.version>3.0.1</servlet-api.version>

      

But m2e still sets the Eclipse facet to 3.1 and not 3.0. The problem is that Eclipse won't deploy a war with Tomcat 7.

What else does m2e need to do, set the facet to 3.0 so that we can upgrade to Spring Boot 1.2.0?

+3


source to share


2 answers


I found a simple solution: m2e-wtp sets the web face of the Eclipse project by looking at the web.xml (if it exists) or scanning the classpath for specific servlet api classes (when web.xml is not found).

Hence, either set the api version of the servlet in web.xml, or set the POM property to a version other than servlet 3.1 (e.g. Spring Boot version 1.1.10 - 7.0.57). Either approach causes m2e-wtp to set the edge accordingly.



I am wondering if the m2e-wtp detection or configuration could be improved as I currently do not know how Tomcat 8 from Servlet 3.0 can be used in this configuration without web.xml.

+1


source


This worked for me:

Add tomcat version to pom.xml under <properties>:

<tomcat.version>7.0.59</tomcat.version>

      



Then go to Properties → Project Face, uncheck the Dynamic Web Module, then OK or Apply. Then do Maven-> Update Project ...

The dynamic web module version must be updated to 3.0

+2


source







All Articles