Eclipse new MAVEN Web project:
1. Create a Web project
Blank---Right-click--->new---->other--->mavenproject--->filter webapp--->maven-archetype-webapp
Question 1:
The superclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path
Solution:
Dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<!--Tomcat Container has API to prevent runtime conflicts provided: compile, test classpath effective run invalid--
<scope>provided</scope>
</dependency>
Question 2:
did not appear Src/main/java
Src/test/java?
Solution:
1.JRE modified to locally installed JDK
In Selected items
JRE System libary Right-click---->build Path--->config Build path--->edit replaced with a locally installed JDK environment
Question 3:
An error xxxx?
Select items----Right-click--->maven--->update project
2.maven Project converted to Web project:
Select item----Right-click--->properties--->project Facets---> Tick Dynamic Web module and specify the corresponding JDK version
3. Check that the directory is in effect:
Src-->main-->webapp-->web-inf
Configuration of the 4.web project deployment:
Select item----Right-click--->properties--->depolyment Assembly--->remove Test folder
Note:
If the MAVEN project does not work correctly, check if Maven Dependencies this directory
5. Check the output directory of the file's classes file:
Select items----Right-click--->properties--->build path--->source---> Check src/main/java, Src/test/java, src/main/ Resources are configured correctly
6. Run the Web project
Web project Run server above:
Jetty
A lightweight Web server
1. Jetty:run
<build>
<finalName>maven-web</finalName>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.6.v20151106</version>
</plugin>
</plugins>
</build>
2.package:
<build>
<finalName>maven-web</finalName>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.6.v20151106</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Tomcat:
Package
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Summary of Problem Solving:
First step through problems view to determine where is the problem?
1. First check whether the specified local installation JDK is
2. Specific error specific treatment
3. MVN clean (excludes errors that you do not want to close)
4. Select the project---->maven--->update project
Eclipe New MAVEN Web project