Eclipse - 如何更改“Project Facet”? 从 Tomcat 6 到 Tomcat 5.5?
(Eclipse 3.4,Ganymede)
我在 Eclipse 中有一个现有的动态 Web 应用程序项目。 创建项目时,我在“配置”下拉列表下指定了“Apache Tomcat v6 的默认配置”。
一两个月后,我现在想将配置更改为 Tomcat 'v5.5'。 (这将是生产服务器上 Tomcat 的版本。)
我已尝试以下步骤(没有成功):
- 我在项目
Properties
下选择了Targeted Runtimes
Tomcat v5.5
选项已禁用,UI 显示以下消息:如果您要选择的运行时未显示或被禁用,您可能需要卸载一个或多个当前安装的项目 Facet。
- 然后,我单击了
卸载 Facets...
代码> 链接。
在Runtimes
选项卡下,仅显示Tomcat 6
。
对于动态 Web 模块
,我选择了2.4
版本来代替2.5
。
在Runtimes
选项卡下,现在显示Tomcat 5.5
。
但是,UI 现在显示此消息:无法将项目构面动态 Web 模块的版本更改为 2.4。
Finish
按钮被禁用 - 所以我进入了死胡同。
我可以使用 Tomcat v5.5 配置成功创建一个新项目。 但出于某种原因,它不会让我降级现有项目。
作为解决方法,我创建了一个新项目并从旧项目复制了源文件。 尽管如此,解决方法相当痛苦,而且有些笨拙。
谁能解释一下如何将项目配置从“Tomcat 6”“降级”到“Tomcat 5”? 或者也许可以解释为什么会发生这种情况?
谢谢
皮特
(Eclipse 3.4, Ganymede)
I have an existing Dynamic Web Application project in Eclipse. When I created the project, I specified 'Default configuration for Apache Tomcat v6' under the 'Configuration' drop down.
It's a month or 2 down the line, and I would now like to change the configuration to Tomcat 'v5.5'. (This will be the version of Tomcat on the production server.)
I have tried the following steps (without success):
- I selected
Targeted Runtimes
under the ProjectProperties
TheTomcat v5.5
option was disabled and The UI displayed this message:If the runtime you want to select is not displayed or is disabled you may need to uninstall one or more of the currently installed project facets.
- I then clicked on the
Uninstall Facets...
link.
Under theRuntimes
tab, onlyTomcat 6
displayed.
ForDynamic Web Module
, I selected version2.4
in place of2.5
.
Under theRuntimes
tab,Tomcat 5.5
now displayed.
However, the UI now displayed this message:Cannot change version of project facet Dynamic Web Module to 2.4.
TheFinish
button was disabled - so I reached a dead-end.
I CAN successfully create a NEW Project with a Tomcat v5.5 configuration. For some reason, though, it will not let me downgrade' an existing Project.
As a work-around, I created a new Project and copied the source files from the old Project. Nonetheless, the work-around was fairly painful and somewhat clumsy.
Can anyone explain how I can 'downgrade' the Project configuration from 'Tomcat 6' to 'Tomcat 5'? Or perhaps shed some light on why this happened?
Thanks
Pete
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您使用 Maven,则可以使用 Maven Eclipse 插件生成 Eclipse 设置。
对于 jst.web 版本,Maven eclipse 插件会考虑项目的依赖关系。 如果您定义了 servlet api 依赖项:
您的 jst.web 参数将为 6.0
If you are using maven you can generated the eclipse settings using the maven eclipse plugin.
For the jst.web version the Maven eclipse pluging takes into account the dependencies of the project. If you have a servlet api dependency defined :
You jst.web parameter will be 6.0
如果您使用的是 Maven,则关闭 eclipse,然后输入
>mvn eclipse:eclipse -Dwtpversion=2.0
,然后重新启动 eclipse。if you are using Maven, then shutdown eclipse, then type
>mvn eclipse:eclipse -Dwtpversion=2.0
, and restart the eclipse.抱歉,如果没有足够的代表,我似乎无法发表评论,所以...
我认为 Eclipse 很难安全地降级到较低的标准,因为它无法真正知道您是否使用了较新的 Web 标准中的某些内容。 因此,如果它只是允许您这样做,则可能会导致您的程序在旧版本上失败。
您始终可以向后兼容,但不能向前兼容。
Sorry it seems I can't post a comment without enough Rep so...
I think it's too difficult for eclipse to degrade safely to a lower standard because it can't really know if you've used something from the newer web standard. So if it just allows you do to that it could cause your program to fail on an older version.
You can always be backward compatible but not forwards compatible.
您可以尝试取消选中构面,应用,更改构面的值并检查。 它在 Eclipse Helios SR1 中适用于我。
所以主要的区别是我使用“动态 Web 模块”来实现。
我希望它也适合你。
You can try to uncheck the facet, apply, change the value of the facet and check. It works for me in Eclipse Helios SR1.
So the main difference is that I do it with 'Dynamic Web Module'.
I hope it works for you too.
我看到了同样的事情,然后我更改了 web.xml 中的网络应用程序版本值。 这样做可以为您解决这个问题。
I saw the same thing, then I changed the web-app version value in the
web.xml
. Doing so could fix this for you.这是一种 hacking eclipse,这样做可能会遇到麻烦,但这应该可行:
打开导航器视图,发现项目下有一个 .settings 文件夹,展开它,然后打开文件:
org.eclipse。 wst.common.project.facet.core.xml
您应该看到一行内容:<代码>
<安装的facet=“jst.web”版本=“2.5”/>
将其更改为 2.4 并保存。
只要确保您的项目没有使用 2.5 特定的任何内容,您就可以了。
另请检查您的 web.xml 是否具有正确的配置:
This is kind of hacking eclipse and you can get into trouble doing this but this should work:
Open the navigator view and find that there is a .settings folder under your project expand it and then open the file:
org.eclipse.wst.common.project.facet.core.xml
you should see a line that says:<installed facet="jst.web" version="2.5"/>
Change that to 2.4 and save.
Just make sure that your project isn't using anything specific for 2.5 and you should be good.
Also check your web.xml has the correct configuration:
这可能很旧,但我尝试并在 eclipse Galilio 中发现了以下内容。
打开导航视图,发现你的项目下有一个.settings文件夹,将其展开,然后打开文件:org.eclipse.wst.common.project.facet.core。删除该文件的内容,右键单击项目并单击属性。 转到弹出窗口中的 Project Facats,您可以单击运行时选项卡并将项目转换为您想要的新方面。
This may be old but I tried and found the following in eclipse Galilio.
Open the navigator view and find that there is a .settings folder under your project expand it and then open the file: org.eclipse.wst.common.project.facet.core.Delete the content of this file and right click on the project and click on properties. Go to Project Facats in the popup window there you can click on runtime tabs and convert your project to the new facet you want.