1. Go to the project directory, find the. project file, and open it.
2. Find <natures>... </natures>Code, Add the following TAG 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. Setting and copy the following files from the. Setting file of other eclipse web projects (if not, create one using eclipse ).
. Jsdtscopeorg. eclipse. JST. common. project. facet. core. prefsorg. eclipse. WST. common. componentorg. eclipse. WST. common. project. facet. core. xmlorg. eclipse. WST. jsdt. UI. supertype. containerorg. eclipse. WST. jsdt. UI. supertype. name
4. Modify the project name in 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 place where the preceding deploy-name value is the same to your project name, and change source-path to/webroot (If your project directory is webcontent, you don't need to change it)
Then the. jsdtscope file:
<? 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 the path in <classpathentry kind = "src" Path = "webroot"/> to/webroot (If your project directory is webcontent, you don't need to change it)
5. Right-click the Eclipse project and refresh the project. You will find that the project has become a web project, and then add it to Tomcat. Tomcat can identify our project.