Eclipse+maven Integrated Development Java Project (ii)? MAVEN projects above webapp3.0

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.