1. Go to the project directory and locate the. project file, open.
2. Find ... Code snippet, add the following label content and save:
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature><nature> Org.eclipse.jdt.core.javanature</nature><nature>org.eclipse.wst.jsdt.core.jsnature</nature>
3. Delete the files under the. setting, and copy the following files from the other Eclipse Web project (if not the new one with Eclipse) under the. setting file
. jsdtscope
Org.eclipse.jst.common.project.facet.core.prefs
Org.eclipse.wst.common.component
Org.eclipse.wst.common.project.facet.core.xml
Org.eclipse.wst.jsdt.ui.superType.container
Org.eclipse.wst.jsdt.ui.superType.name
4. Modify the contents of the project name in the Org.eclipse.wst.common.component
<?xml version= "1.0" encoding= "UTF-8"? ><project-modules id= "Modulecoreid" project-version= "1.5.0" > <wb-module deploy-name= "Springweb" > <wb-resource deploy-path= "/" source-path= "/webroot" tag= "Defaultrootsource"/> <wb-resource deploy-path= "/web-inf/classes" source-path= "/SRC"/> <property name= "Context-root" value= "Springweb"/> <property name= "Java-output-path" value= "/springweb1/build/classes"/> </wb-module></project-modules> change the above so that the deploy-name value is the same as your project name, while the Source-path Change to/webroot (if your project directory is webcontent do not change) <?xml version= "1.0" encoding= "UTF-8"?><classpath> <classpathentry kind= "src" path= "WebRoot"/> <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>
Change <classpathentry kind= "src" path= "WebRoot"/> in Path to/webroot (if your project directory is webcontent you don't have to change it)
5, right-click on the Eclipse Project, refresh the project, you will find that the project becomes a Web project, and then added to Tomcat will find that Tomcat can recognize our project.
Importing external projects cannot be recognized as Web projects cannot be deployed to Tomcat