简体   繁体   English

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

[英]Converting a Java Project to a Dynamic Web Project

I'm using Eclipse Ganymede to create a web application, but the project's currently just a standard Java project. 我正在使用Eclipse Ganymede来创建一个Web应用程序,但该项目目前只是一个标准的Java项目。 I want to convert it to a Dynamic Web Project and I need a hand in doing that. 我想将它转换为动态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. 我已经向我提出了关于编辑.project文件的建议,但是当我重新启动Eclipse时,它拒绝打开声称该文件已损坏的项目。 There's also no facet management options in the project properties. 项目属性中也没有构面管理选项。

Any suggestions? 有什么建议?

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

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文件以添加一些缺少的性质和构建器(创建一个新的Dynamic Web Project并检查创建的.project文件以查看缺少的内容)。

  2. You also need to add things to the .settings folder. 您还需要将内容添加到.settings文件夹中。 It'll be missing two or three files, one of which is a key xml file. 它将丢失两个或三个文件,其中一个是关键的xml文件。 They're all required for it to understand the new natures you've given it. 它们都需要它来理解你给它的新性质。

Huzzah for computers. Huzzah用于电脑。

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. 我花了很长时间(重新)编辑原始.project文件(根据前面提到的网站),直到我发现它。 It was probably was set when I was messing with my maven configuration. 当我弄乱我的maven配置时,可能已经设置好了。

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" . 我找到的解决方案是“检查项目属性/项目构面/动态Web模块”。 For this we need to unlock utility module and then check Dynamic Web Module. 为此,我们需要解锁实用程序模块,然后检查动态Web模块。

But , Utility module is also necessary for Java EE Application. 但是,Utility模块对于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和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文件夹中的文件中复制了必要的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM