czwartek, 12 września 2013

Eclipse Maven project: how to change web.xml version from 2.3 to 3.1

1. Modify pom.xml:


        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>



2. Update Maven project ( alt-F5 ).


You should have Project->Properties->Project Facets->Java->1.7
If you got errors, you should correct  Project->Properties->Java Build Path->Libraries


3. Modify web.xml


<?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_3_1.xsd"
    id="WebApp_ID" version="3.1">
    <!-- your web.xml content here -->
    <display-name>Archetype Created Web Application</display-name>
</web-app>


4. Update Maven project ( alt-F5 ).

If you get errors. Go to step 5.

5. (Most interesting!)  Modify org.eclipse.wst.common.project.facet.core.xml

5.1. Evoke: Window>Show View>Other>General>Navigator
5.2.  Navigate to: org.eclipse.wst.common.project.facet.core.xml
5.3. Modify line: <installed facet="jst.web" version="2.3"/> to
<installed facet="jst.web" version="3.1"/>
5.4. Save changes.

6. Update Maven project ( alt-F5 ).


 

Brak komentarzy:

Prześlij komentarz