The original address: www.cnblogs.com/huangjinwen…
When Eclipse uses Maven to create an SSM framework project (Web project), the default version of the web. XML file is 2.3 and the jre version is 1.5. Encountered various problems in modifying its version
Such as:
Web. XML is missing and <failOnMissingWebXml> is set to true JavaServer Faces 2.2 can not be installed: JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer etc
The wrong configuration order when searching for methods also causes problems. To modify jre and web. XML versions, handle the relationship between each version. For example, Web 3.0 requires Java 1.6 or JavaServer Faces requires Web 2.5 or later. If you know the rules, you can solve the problem well.
The following is a summary of the method, with the entire process of creation.
Eclipse Release :Neon. 1A Release (4.6.1)
1. Create a Maven Project
Select Maven Project
Select maven archetype – webapp
The Group Id is the unique identifier of the project organization and actually corresponds to the Java package structure, which is the Java directory structure in the main directory.
The Artifact Id is a unique identifier for the project that actually corresponds to the project name, which is the name of the project root directory.
The structure of the new Maven project is:
Note the structure of the red box, with only one SRC /main/resources, and the HttpServlet error reported below
Project right-click Properties, select Java Build Path, select Add Library, Add Server Runtime, select Apache Tomcat Server (Tomcat8 requires Web version 3.1)
SRC /main/ Java and SRC /test/ Java directories are automatically completed
At this point, the Maven project is web.xml version 2.3 and jre version 1.5, which needs to be upgraded.
2. Modify the jre version and web. XML version of the project
The online version is many and miscellaneous, their own practice is the key
2.1 Modifying the JRE Version
Change the JRE version, which cannot be changed in the Java Bulid Path. Once the update project returns to version 1.5, you can declare it in the POM.xml file
pom.xml
. <build> <finalName>TestMaven3</finalName>
<! — Change maven’s default JRE build version. 1.8 represents the JRE build version. Select 1.7 or 1.8 according to your installed version –> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> < artifactId > maven — the compiler plugin < / artifactId > < configuration > < source > 1.8 < / source > < target > 1.8 < / target > </configuration> </plugin> </plugins> </build> </project>
Right-click on the Project and select the Java Build Path of the Maven Update Project as follows:
You can then Edit to specify the JRE to Workspace default JRE
2.2 Modifying the web. XML File Version
The default generated web.xml, as you can see, is version 2.3.
Item Right-click Properties and select Project Facets (Item Template). As shown in the figure below, you can see that the Dynamic Web Module version is 2.3
Change it to 3.0? , but it cannot be changed
Uncheck the Dynamic Web Module and then Apply.
Next check Dynamic Web Module. Note that Further Configuration available… Options; Then change to the desired version 3.0 and click Further Configuration Available…
After that, change Content Director to SRC /main/ webApp, check Generate Web.xml Deployment Descriptor, save and exit Project Facets
A WebContent folder containing web.xml is generated and its contents are copied to the original Web.xml
Delete the generated web.xml
After that, right-click the Project and select Maven Update Project.