将 Web 应用程序从 Eclipse 3.1 迁移到 3.6
我有一个客户的大型电子商务 Web 应用程序,我已经在 Eclipse 3.1 中开发了几年。至少可以说,我已经准备好转向 Helios 了。
该 Web 应用程序在 Java 5.0 中的 Tomcat 5.5 上运行。
到目前为止我遇到的建议假设我从头开始或从 WAR 文件开始动态 Web 项目。到目前为止,我能做的最好的事情是:
- 在 Helios 中创建一个新工作区
- 创建一个新的 Tomcat 5.5 服务器
- 导入旧 Eclipse 3.1 项目的副本(导入...>常规>“现有项目到工作区” )
- 编辑新的 .project 文件以包含项目的正确“性质”
- 重新启动 Helios
此时,我尝试将我的 Web 项目作为资源添加到 Tomcat 服务器 Eclipse 说没有资源添加/删除。
任何有关我下一步的建议,或者将旧网络应用程序导入 Helios 的更好方法,将不胜感激!
更新:
我选择了下面建议的“干净”选项,这就是我的做法:
- 打开Helios,启动一个新的(即空)工作区
- 创建一个新项目,选择“动态Web项目”
- 说“是” ”到“创建本地Web服务器”,配置您的Web服务器运行环境等。
- 点击“下一步>”通过“添加源文件夹”步骤
- 单击“完成”
- 在主项目窗口中,返回到旧源的副本并选择 WEB-INF 文件夹的内容,*除了“
src”
”(后面的步骤)和“classes
”(不必要)*;将所选文件/文件夹复制到动态 Web 项目的 WebContent 节点中的WEB-INF
文件夹 - 最后,将
WEB-INF\src
的内容拖到“<动态 Web 项目的 Java 资源节点下的“code>src”文件夹 - 如果您的 Web 应用程序没有出现在屏幕底部“服务器”选项卡中的 Tomcat 服务器下,请右键单击该服务器并选择“添加并删除...”——您的网络项目肯定会是感谢
所有回答者的帮助和完全理智的建议!
I have a client's large-ish e-commerce web app that I've been developing for several years in Eclipse 3.1. To say the least, I'm ready to move on to Helios.
The web app runs on Tomcat 5.5 in Java 5.0.
The advice I've encountered so far presumes I'm starting a Dynamic Web Project from scratch, or from a WAR file. The best I've been able to do so far is:
- Create a new workspace in Helios
- Create a new Tomcat 5.5 server
- Import a copy of the old Eclipse 3.1 project (Import... > General > "Existing Projects into Workspace")
- Edit the new .project file to include the correct "Natures" for the project
- Restart Helios
At this point I try to add my web project as a resource to the Tomcat server Eclipse says there are no resources to add/remove.
Any advice on what my next step is, or an altogether better method for importing old web apps into Helios would be much appreciated!
UPDATE:
I chose the "clean" option suggested below, here's how I did it:
- Open Helios, start a new (i.e. EMPTY) workspace
- Create a New project, select "Dynamic Web Project"
- Say "Yes" to "Create a local webserver", configure your webserver runtime environment, etc.
- Click "Next >" through the 'add source folders' step
- Click "Finish"
- In the main project window, go back to a copy of the old source and select the contents of the WEB-INF folder, *except for the "
src
" (later step) and "classes
" (not necessary) *; copy your selected files/folders to theWEB-INF
folder in the WebContent node of your Dynamic Web Project - Last, drag the contents of
WEB-INF\src
to the "src
" folder under the Java Resources node of your Dynamic Web Project - If your web app does not appear under the Tomcat server in the Servers tab at the bottom of the screen, right-click the server and select "Add and Remove..." -- your web project will positively be there
Thanks for the help and the downright sane advice from all the answer-ers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用 Eclipse“添加性质”对话框,而不是“4. 编辑新的 .project 文件以包含项目的正确“性质””
You should use Eclipse "add nature" dialogs instead of "4. Edit the new .project file to include the correct "Natures" for the project"
您应该将项目导入 Helios 工作区,转到项目属性,选择“Project Facets”添加所需的所有方面,选择 Tomcat 作为运行时环境(我建议您在 Window -> Preferences 中将 Tomcat 添加为服务器-> 服务器 -> 运行时环境)。
之后,您应该能够选择 Run On Server 以查看您的应用程序部署到 Tomcat...
You should just import the project into the Helios workspace, go to the project properties, select the "Project Facets" add all the facets needed, choose Tomcat as runtime environment (I recommend you to add Tomcat as a server in Window -> Preferences -> Server -> Runtime Environments first).
After this you should be able to choose Run On Server to see your application deployed to Tomcat...
您有两个选择:
虽然选项#1 一般情况下工作正常,但我建议继续使用选项#2,因为您将摆脱所有这些不再需要工件。毫无疑问,这完全取决于您项目的复杂性以及您的团队规模。在过去的几年里,我将许多(或多或少)复杂的应用程序从一个 Eclipse IDE 版本迁移到另一个版本。创建一个新的、干净的工作区并从头开始导入源代码确实有意义 - 如果有清理的机会,请利用它:-)
You have two options:
Although option #1 works fine in general, I recommend to proceed with option #2 as you get rid of all those artifacts not required any more. No question that it all depends of the complexity of your project and maybe your team size. Over the past years I've migrated a number of (more or less) complex applications from one eclipse IDE version to another. Creating a new, clean workspace and importing your sources from scratch does make sense - if there is a chance for cleanup make use of it :-)