Converting a Java Project to a Dynamic Web Project

2019-02-02 22:14发布

问题:

I'm using Eclipse Ganymede to create a web application, but the project's currently just a standard Java project. I want to convert it to a Dynamic Web Project and I need a hand in doing that.

I've had suggestions given to me about editing the .project file, but when I restart Eclipse it refuses to open the project claiming the file is corrupt. There's also no facet management options in the project properties.

Any suggestions?

回答1:

Although this question is already answered I'd like to say that I managed to convert my project into web project by changing project facets Properties->Project Facet and just checked Dynamic Web Module



回答2:

Well. I'll tell you why, folks. It's because a lot of these guides miss out some fundamental things.

  1. Yes, you need to change the .project file to add some missing natures and builders (create a new Dynamic Web Project and examine the created .project file to see what's missing).

  2. You also need to add things to the .settings folder. It'll be missing two or three files, one of which is a key xml file. They're all required for it to understand the new natures you've given it.

Huzzah for computers.



回答3:

When you cannot add the "Dynamic Web Module" via "Project Facets" make sure you unlock and disable the "Utility Module" since they are mutually exclusive.

I've spend quite sometime (re)editing the raw .project-file (according to the earlier mentioned sites) until I discovered this. It was probably was set when I was messing with my maven configuration.



回答4:

Run on server option is not displaying in eclipse .

The solution for it that i found is " check Project properties / Project Facets / Dynamic Web module" . For this we need to unlock utility module and then check Dynamic Web Module.

But , Utility module is also necessary for Java EE Application. So how to select both Utility and Dynamic Web Module to make it Dynamic Web Project so that we can get Run On server Option.

Note : I have already copied necessary things in .project file and files in .settings folder.