将Java项目转换为动态Web项目

时间:2023-02-05 17:33:17

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.

我正在使用Eclipse Ganymede来创建一个Web应用程序,但该项目目前只是一个标准的Java项目。我想将它转换为动态Web项目,我需要亲自动手。

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.

我已经向我提出了有关编辑.project文件的建议,但是当我重新启动Eclipse时,它拒绝打开声称该文件已损坏的项目。项目属性中也没有构面管理选项。

Any suggestions?

4 个解决方案

#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

虽然这个问题已经回答了,但我想说我设法通过更改项目方面属性 - >项目方面将项目转换为Web项目,并且只检查了动态Web模块

#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).

    是的,您需要更改.project文件以添加一些缺少的性质和构建器(创建一个新的动态Web项目并检查创建的.project文件以查看缺少的内容)。

  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.

    您还需要将内容添加到.settings文件夹中。它将丢失两个或三个文件,其中一个是关键的xml文件。它们都需要它来理解你给它的新性质。

Huzzah for computers.

Huzzah用于电脑。

#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.

当您无法通过“Project Facets”添加“Dynamic Web Module”时,请确保解锁并禁用“Utility Module”,因为它们是互斥的。

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.

我花了很长时间(重新)编辑原始.project文件(根据前面提到的网站),直到我发现它。当我搞乱我的maven配置时,可能已经设置好了。

#4


Run on server option is not displaying in eclipse .

在服务器上运行选项不会在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.

我找到的解决方案是“检查项目属性/项目构面/动态Web模块”。为此,我们需要解锁实用程序模块,然后检查动态Web模块。

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.

但是,Utility模块也是Java EE Application所必需的。那么如何选择Utility和Dynamic Web Module来使其成为Dynamic Web Project,以便我们可以获得Run On服务器选项。

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

注意:我已经在.project文件和.settings文件夹中的文件中复制了必要的东西。

#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

虽然这个问题已经回答了,但我想说我设法通过更改项目方面属性 - >项目方面将项目转换为Web项目,并且只检查了动态Web模块

#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).

    是的,您需要更改.project文件以添加一些缺少的性质和构建器(创建一个新的动态Web项目并检查创建的.project文件以查看缺少的内容)。

  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.

    您还需要将内容添加到.settings文件夹中。它将丢失两个或三个文件,其中一个是关键的xml文件。它们都需要它来理解你给它的新性质。

Huzzah for computers.

Huzzah用于电脑。

#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.

当您无法通过“Project Facets”添加“Dynamic Web Module”时,请确保解锁并禁用“Utility Module”,因为它们是互斥的。

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.

我花了很长时间(重新)编辑原始.project文件(根据前面提到的网站),直到我发现它。当我搞乱我的maven配置时,可能已经设置好了。

#4


Run on server option is not displaying in eclipse .

在服务器上运行选项不会在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.

我找到的解决方案是“检查项目属性/项目构面/动态Web模块”。为此,我们需要解锁实用程序模块,然后检查动态Web模块。

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.

但是,Utility模块也是Java EE Application所必需的。那么如何选择Utility和Dynamic Web Module来使其成为Dynamic Web Project,以便我们可以获得Run On服务器选项。

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

注意:我已经在.project文件和.settings文件夹中的文件中复制了必要的东西。