Overview
Eclipse integrated maven plugin, when new Maven-archetype-webapp project, the use of WebApp version of the lower, The default is 2.3, and sometimes we want to upgrade the WebApp version to 3.0 (Tomcat support up to 3.0), modify the WebApp property through Eclipse Project facets in the dynamic web When module is 3.0, Eclipse prompts for cannot change version Web module 3.0, but sometimes we want to force the 3.0 version, and we need to modify some of the corresponding configuration;
modifying configuration Items
1, the new project, error content:
The superclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path
The way to handle the pom.xml is to add the corresponding servlet dependencies:
<dependency> <groupId>javax.servlet</groupId> <artifactid>javax.servlet-api </artifactId> <version>3.1. 0</version> <scope>provided</scope> </dependency>
2. Modify the WebApp 3.0 version method
2.1. Modify the Web. XML Configuration Header
<?xml version="1.0"encoding="UTF-8"? ><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="Http://java.sun.com/xml/ns/javaee"xsi:schemalocation="Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"ID="webapp_id"version="3.0"></web-app>
2.2, modify the ORG.ECLIPSE.WST.COMMON.PROJECT.FACET.CORE.XM
<?xml version="1.0"encoding="UTF-8"?><faceted-project> <fixedfacet="Wst.jsdt.web"/> <installed facet="Java"version="1.7"/> <installed facet="Wst.jsdt.web"version="1.0"/> <installed facet="Jst.web"version="3.0"/></faceted-project>
2.3, modify the Pom.xml, under the Build tab, add the following content
<plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> < Version>3.1</version> <configuration> <source>1.7</ source> <target>1.7</target> </configuration> </plugin> </plugins>
Then project, right-click –> maven–> Update Project to
Reference Blog
1. Eclipse builds MAVEN projects above webapp3.0 http://blog.csdn.net/frankcheng5143/article/details/51282819
Eclipse+maven Integrated Development Java Project (ii)? MAVEN projects above webapp3.0