With Spring Boot 1.2.0, m2e sets the Eclipse Project Facet "Dynamic Web Project" to 3.1. This is expected as Spring Boot 1.2.0 newly supports Servlet Spec 3.1.
使用Spring Boot 1.2.0, m2e将Eclipse项目方面的“动态Web项目”设置为3.1。这是预期的Spring Boot 1.2.0新支持Servlet Spec 3.1。
However, we need to stay with 3.0 (Tomcat 7), so we set the correct property in our POM per the Boot instructions:
但是,我们需要保持3.0 (Tomcat 7),所以我们根据引导说明在POM中设置了正确的属性:
<servlet-api.version>3.0.1</servlet-api.version>
But m2e still sets the Eclipse facet to 3.1, not 3.0. The problem is Eclipse will not deploy the war to Tomcat 7.
但是m2e仍然将Eclipse方面设置为3.1,而不是3.0。问题是Eclipse不会将war部署到Tomcat 7。
What else needs setting to make m2e set the facet to 3.0 so we can upgrade to Spring Boot 1.2.0?
还需要设置什么来让m2e将facet设置为3.0,这样我们就可以升级到Spring Boot 1.2.0了?
2 个解决方案
#1
2
This worked for me:
这工作对我来说:
Add the tomcat version to the pom.xml under < properties> :
将tomcat版本添加到pom中。xml under < properties>:
<tomcat.version>7.0.59</tomcat.version>
Then go to Properties -> Project Facets, uncheck Dynamic Web Module, then Ok or Apply. Then do Maven->Update Project...
然后转到属性—>项目facet,取消动态Web模块检查,然后单击Ok或Apply。然后做Maven - >更新项目…
The Dynamic Web Module version should have updated to 3.0
动态Web模块版本应该更新为3.0。
#2
1
I found a simple solution: m2e-wtp sets the Eclipse project web facet by looking at web.xml (if it exists) or scanning the classpath for specific servlet api classes (when web.xml not found).
我找到了一个简单的解决方案:通过查看web来设置Eclipse项目web方面。xml(如果存在)或扫描特定servlet api类的类路径(当web时)。xml没有找到)。
Therefore, either set the servlet api version in web.xml or set POM property to a non-servlet 3.1 version (e.g. the Spring Boot 1.1.10's version is 7.0.57). Either approach causes m2e-wtp to set the facet accordingly.
因此,可以在web中设置servlet api版本。将POM属性设置为非servlet 3.1版本(例如,Spring Boot 1.1.10的版本是7.0.57)。这两种方法都会导致m2e-wtp相应地设置方面。
I am wondering if it is possible to improve m2e-wtp's detection or configuration as currently I don't know how it is possible in this configuration to use Tomcat 8 with servlet 3.0 without a web.xml.
我想知道是否有可能改进m2e-wtp的检测或配置,因为目前我不知道在这个配置中如何能够在servlet 3.0中使用Tomcat 8而不使用web.xml。
#1
2
This worked for me:
这工作对我来说:
Add the tomcat version to the pom.xml under < properties> :
将tomcat版本添加到pom中。xml under < properties>:
<tomcat.version>7.0.59</tomcat.version>
Then go to Properties -> Project Facets, uncheck Dynamic Web Module, then Ok or Apply. Then do Maven->Update Project...
然后转到属性—>项目facet,取消动态Web模块检查,然后单击Ok或Apply。然后做Maven - >更新项目…
The Dynamic Web Module version should have updated to 3.0
动态Web模块版本应该更新为3.0。
#2
1
I found a simple solution: m2e-wtp sets the Eclipse project web facet by looking at web.xml (if it exists) or scanning the classpath for specific servlet api classes (when web.xml not found).
我找到了一个简单的解决方案:通过查看web来设置Eclipse项目web方面。xml(如果存在)或扫描特定servlet api类的类路径(当web时)。xml没有找到)。
Therefore, either set the servlet api version in web.xml or set POM property to a non-servlet 3.1 version (e.g. the Spring Boot 1.1.10's version is 7.0.57). Either approach causes m2e-wtp to set the facet accordingly.
因此,可以在web中设置servlet api版本。将POM属性设置为非servlet 3.1版本(例如,Spring Boot 1.1.10的版本是7.0.57)。这两种方法都会导致m2e-wtp相应地设置方面。
I am wondering if it is possible to improve m2e-wtp's detection or configuration as currently I don't know how it is possible in this configuration to use Tomcat 8 with servlet 3.0 without a web.xml.
我想知道是否有可能改进m2e-wtp的检测或配置,因为目前我不知道在这个配置中如何能够在servlet 3.0中使用Tomcat 8而不使用web.xml。