Once a project is created in Eclipse Europa of a certain type, it’s not the most straight forward process of changing the project to a different type. For example you have a project that Eclipse considers to be a Java project, but it’s actually a Web Project, you don’t get to take advantage of all of the features available for Web Projects, such as deploying to a local tomcat server, unless Eclipse is aware that it’s a web project. This has to do with the project settings and what eclipse considers the “Nature” of the project.
For example to convert a Java Project to a Web Project switch to or open the Resource Perspective of the project, in the root of the project. Open the .project file and make sure the builders and natures are present that are needed for a web project. See the example below, the name should be the name of your project, the most important nodes are the nature children in the natures node:
testProject org.eclipse.jdt.core.javabuilder org.eclipse.wst.common.project.facet.core.builder org.eclipse.wst.validation.validationbuilder org.eclipse.wst.common.project.facet.core.nature org.eclipse.jdt.core.javanature org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.jem.workbench.JavaEMFNature
Once you’ve updated the .project file you can close the file and right click and choose properties on the project. When the properties window opens click on Project Facets. The Facets grid is probably empty, click the Modify Project button. Check the Dynamic Web Module and Java Facets, choose the Java and Servlet version that applies to your project. Click Next and specify the existing or new location of your src and web content directories. Click Finish.
As a final step I would recommend modifying the build path to compile your source directly into your /WEB-INF/classes directory by selecting Java Build Path and modifying the Default output directory.
Now you should be able to create a local tomcat server, or if you’ve already created one you should be able to add the project to the server by right clicking the server and choosing Add and Remove Projects.
Comments
Web 2.0 Announcer 2:16 pm on May 5, 2008
Converting a Java project to a Dynamic Web project in Eclipse…
[...]Converting a java project to a dynamic web project in Eclipse, so that you can deploy your web application to a local server.[...]…
Holgers Blog » Ein Eclipse Webprojekt migrieren 8:08 am on May 26, 2008
[...] Artikel [...]
Don Hosek 5:52 pm on July 15, 2008
Any thoughts on why the jars in the project’s build path aren’t being copied into the lib directory?
webguy 9:10 pm on July 15, 2008
Are you in the Java perspective? Try switching to the Resource perspective and see if you see the jars in the lib directory.
Leave a Comment