Some eclipse may be the cause of the low version, resulting in Eclipse, MAVEN, and Tomcat not well integrated. Here are some personal experiences to solve this problem.
1: Create a MAVEN project, this step is not detailed.
2: Right-click to convert the MAVEN project to a dynamic Web project.
The 3:maven project is built with a/src/main/webapp folder, which actually corresponds to the webcontent directory of the Eclipse Dynamic Web project. Eclipse when you convert a MAVEN project to a Dynamic Web project, several files are generated under the project. Under Settings, two of these files need to be modified. Jsdtscope and Org.eclipse.wst.common.component, find the webcontent inside. , replace it with/src/main/webapp, where eclipse can copy the files under/src/main/webapp to Tomcat, but there is a problem that Maven's managed jars cannot replicate to Tomcat. Also, in the previous two files, configure the path of the Maven-compiled project to it. Org.eclipse.wst.common.component plus <wb-resource deploy-path= "/" source-path= "/target/autodeploy-0.0.1-snapshot "/>. Jsdtscope plus <classpathentry kind=" src "path=" target/autodeploy-0.0.1-snapshot "/>, and finally delete the WebContent directory.
Finally, the configuration of Jsdtscope is as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<classpath>
<classpathentry kind= "src" path= "target/autodeploy-0.0.1-snapshot"/><!--This line is a new addition to the-->
<classpathentry kind= "src" path= "Src/main/webapp"/><!--The original path of this line is webcontent->
<classpathentry kind= "Con" path= "Org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind= "Con" path= "Org.eclipse.wst.jsdt.launching.WebProject" >
<attributes>
<attribute name= "Hide" value= "true"/>
</attributes>
</classpathentry>
<classpathentry kind= "Con" path= "org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind= "Output" path= ""/>
</classpath>
The org.eclipse.wst.common.component configuration is as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<project-modules id= "Modulecoreid" project-version= "1.5.0" >
<wb-module deploy-name= "Autodeploy" >
<wb-resource deploy-path= "/" source-path= "/target/autodeploy-0.0.1-snapshot"/><!--This line is a new addition to the-->
<wb-resource deploy-path= "/" source-path= "/src/main/webapp" tag= "Defaultrootsource"/><!-- This line originally Source-path is webcontent->
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/main/java"/>
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/main/resources"/>
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/test/java"/>
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/test/resources"/>
<property name= "Context-root" value= "Autodeploy"/>
<property name= "Java-output-path" value= "/autodeploy/src/main/webapp/web-inf/classes"/>
</wb-module>
</project-modules>