eclipse에서 maven project를 생성하면 아래처럼 버전이 낮은 프로젝트가 생성된다.
    - JRE 버전 : 1.5
    - Dynamic Web Module (web.xml) 버전 : 2.3

프로젝트 Properties > Project Facets 에서 Dynamic Web Module를 3.0으로 변경하면
"Cannot change version of project facet Danymic Web Module to 3.0" 이란 메시지가 나오면서 변경이 안된다.

1. web.xml 변경 (Dynamic Web Module 2.3 -> 3.0)

Servlet 4.0
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
    <display-name>Archetype Created Web Application</display-name>
</web-app>

Servlet 3.1
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
    <display-name>Archetype Created Web Application</display-name>
</web-app>

Servlet 3.0
<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
    <display-name>Servlet 3.0 Web Application</display-name>
</web-app>

Servlet 2.5
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
    <display-name>Archetype Created Web Application</display-name>
</web-app>

Servlet 2.4
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="servlet-2_4" version="2.4">
    <display-name>Servlet 2.4 Web Application</display-name>
</web-app>

Servlet 2.3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>Servlet 2.3 Web Application</display-name>
</web-app>

Servlet 2.2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
    <display-name>Servlet 2.2 Web Application</display-name>
</web-app>


2. pom.xml에 build 추가

<properties>
    <jdk.version>1.7</jdk.version>
</properties>

<build>
        <finalName>${project.name}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                      <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
</build> 


3. 프로젝트 우클릭 > Maven > Update Project 클릭

4. 프로젝트 Facet 변경
    - 프로젝트 Properties > Project Facets 에서 Dynamic Web Module을 3.0으로, Java 1.7 변경
    위 방법으로 할 때
    "Cannot change version of project facet Danymic Web Module to 3.0"이란 메시지가 나오는 경우
    ==> Navigator에서 프로젝트/.settings/org.eclipse.wst.common.project.facet.core.xml 파일 직접 수정

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.7"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project> 


5. Maven Dependencies를 Deployment에 추가
프로젝트 Properties > Deployment Assembly 에서 Add 클릭 - Java Build Path Entries 선택 - Maven Dependencies 선택

6. 프로젝트 우클릭 > Maven > Update Project 클릭


※ 참고 (Tomcat / Servlet / Java Specifications)
http://tomcat.apache.org/whichversion.html

Servlet Spec 

 JSP Spec

 EL Spec

 WebSocket Spec

 Apache Tomcat version

 Actual release revision

 Support JavaEE Versions

 Support JavaSE Versions

 Memo

 4.0

 TBD (2.4?)

 TBD (3.1?)

 TBD (1.2?)

 9.0.x

 None

  8 and later

 


 3.1

 2.3

 3.0

 1.1

 8.0.x

 8.0.18

  7 and later

 

Non-blocking I/O, HTTP protocol upgrade mechanism


 3.0

 2.2

 2.2

 1.1

 7.0.x

 7.0.57

 6 and later
(WebSocket 1.1 requires 7 or later)

 JavaSE 6

JSR 315, Ajax 대응 비동기 지원, 어노테이션에 의한 개발편의성, web.xml 없는 개발 및 배포

 2.5

 2.1

 2.1

 N/A

 6.0.x

 6.0.43

 5 and later

 J2SE 5.0

  JSR 154, Requires J2SE 5.0, supports annotations

 2.4

 2.0

 N/A

 N/A

 5.5.x (archived)

 5.5.36 (archived)

  1.4 and later

 J2SE 1.3

 JSR 154, web.xml uses XML Schema

 2.3

 1.2

 N/A

 N/A

 4.1.x (archived)

 4.1.40 (archived)

 1.3 and later

 J2SE 1.2

 Addition of Filters

 2.2

 1.1

 N/A

 N/A

 3.3.x (archived)

 3.3.2 (archived)

 1.1 and later

 J2SE 1.2

 Becomes part of J2EE, introduced independent web applications in .war files





+ Recent posts