Resolves the MAVEN Web project created by Eclipse and cannot be published to Tomcat__web

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.