更新项目配置后,Maven 从 Eclipse 和 JBossAS 工具中隐藏 Web.xml
我使用的是 Eclipse Indigo,安装了 JBoss Tools 3.3 中的“Jboss Maven Integration”和“JBossAS Tools”插件(没有安装其他二十个左右的 JBoss Tools 插件)。该应用程序正在使用 JBossAS Tools 4.2 运行时部署到 JBoss 4.2。
以下是重现问题的步骤...
创建动态 Web 项目
1.使用 JBoss AS 4.2 运行时的默认设置
该项目是使用默认部署描述符创建的,其中包含欢迎文件列表。 “欢迎页面”图标可以在项目资源管理器中展开,列出“web.xml”中的文件。
2. 转换为 Maven 项目
我右键单击该项目并选择“配置 >” ; 转换为 Maven 项目”。我指定“war”包装并为其指定名称和描述。
此时可以修改并保存“web.xml”和更改将立即反映在项目资源管理器中。
3. 更新项目配置
右键单击项目,然后选择“Maven > 更新项目配置...”,让 Maven 更新项目配置。 (通常您会在执行此操作之前更改 POM 中的一些构建配置,但即使您立即更新也会出现问题。)
4. Eclipse 不再读取 Web.xml
更新项目后,一切看起来都很好。但下次保存“web.xml”时,它不再正确显示在项目资源管理器中。
这真的很奇怪,因为即使“web.xml”没有被如果显示正确,当您双击 Project Explorer 中的 Deploymen Descriptor 时,Eclipse 会正确打开文件。
Project Explorer 无法显示内容并不是真正的问题。它只是表明 Eclipse 无法正确看到“web.xml”。真正的问题是,使用 JBoss Tools,我无法通过按“触摸描述符”按钮(小手)来重新部署解决方案,因为它告诉我该项目没有任何可以触摸的描述符。看起来 Eclipse 无法向 JBoss 插件或其他东西提供对“web.xml”的引用......
有什么想法吗? :)
I'm using Eclipse Indigo, with the "Jboss Maven Integration" and "JBossAS Tools" plugins from JBoss Tools 3.3 installed (none of the other twenty or so JBoss Tools plugins). The application is being deployed to a JBoss 4.2 using the JBossAS Tools 4.2 runtime.
Here are the steps to reproduce the problem...
1. Create Dynamic Web Project
The project is created with a default deployment descriptor which contains a list of welcome files. The "Welcome Pages" icon can be expanded in the Project Explorer, listing the files in "web.xml".
2. Convert to Maven Project
I right-click the project and select "Configure > Convert to Maven Project". I specify "war" packaging and give it a name and description.
At this point, you can modify and save "web.xml" and the changes will immediately reflected in the Project Explorer.
3. Update Project Configuration
Have Maven update the project configuration by right-clicking the project, then selecting "Maven > Update Project Configuration...". (Usually you would change some build configuration in the POM before doing this, but the problem happens even if you just update right away.)
4. Web.xml isn't Read by Eclipse Anymore
Immediately after updating the project, everything looks fine. But the next time you save "web.xml" it is no longer properly displayed in the Project Explorer.
It's really weird because even though "web.xml" isn't being displayed properly, Eclipse opens the file correctly when you double click on Deploymen Descriptor in the Project Explorer.
The Project Explorer's inability to display the contents isn't the real problem. It just indicates that Eclipse can't see "web.xml" properly. The real problem is that using JBoss Tools, I can't redeploy the solution by pressing the "Touch Descriptors" button (the little hand) because it tells me the project doesn't have any descriptors to touch. It seems like Eclipse is unable to give a reference to "web.xml" to the JBoss plugin or something...
Any ideas? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您安装了 m2e-wtp,它应该“正常工作”。 m2e-wtp 是 m2e 的插件,它尽力将 Maven 项目模型与 Eclipse 的 Web 项目模型连接起来。
安装 m2e-wtp 并获得 CDI、Hibernate、JSF 等附加自动配置的最简单方法是安装 JBoss Maven Tools。
如果由于某种原因您不想要这种额外的易用性,那么您可以从 Eclipse Marketplace 获取 m2e-wtp。
ps 在最新版本的 jboss 工具中,您还可以简单地重新启动服务器视图中的各个模块 - 这是为了支持无描述符项目。应移动“触摸描述符”来支持这一点。
It should "just work" assuming you have m2e-wtp installed. m2e-wtp is the plugin for m2e that does a best-effort to wire up Mavens project model with Eclipse's Web Project model.
The simplest way of installing m2e-wtp and get additional automatic configuration for CDI, Hibernate, JSF, etc. is to install JBoss Maven Tools.
If you for some reason do not want this additional ease-of-use then you can get m2e-wtp from Eclipse Marketplace.
p.s. in recent versions of jboss tools you can also simply restart the individual modules in the server view - which is there to support descriptor less projects. The "touch descriptors" should be moved to support this instead.