Eclipse:将“动态 Web 模块”转换为至“网页片段模块”

发布于 2024-10-27 09:09:44 字数 1410 浏览 4 评论 0原文

我决定将一个动态 Web 应用程序拆分为两个动态 Web 应用程序,一个核心部分和一个项目特定部分。如果我运行 Maven,由于其 pom.xml,我会得到核心项目的 JAR 文件。

然而,对于 WTP,我似乎无法说服 Eclipse 将核心项目部署为 JAR 文件。如果我将项目的“部署程序集”中的目标文件名从 blah.war 编辑为 blah.jar,关闭并重新打开项目属性,它又是一个 WAR 文件。

所以我决定尝试将核心项目打造成一个Web片段模块(我在拆分原始项目时没有注意到)。如果我取消选择“动态 Web 模块”并在项目方面选择“Web 片段模块”,则不允许单击“应用”或“确定”,因为它们呈灰色。

我现在该怎么办?最后,我希望 WTP 将核心项目的 JAR 文件写入 Web 应用程序的 lib 文件夹中。


编辑:

我创建了一个新的 Web 片段项目,并试图找到与我的动态 Web 项目的明显差异。唯一明显的区别是 .settings/org.eclipse.wst.common.project.facet.core.xml 中的过去

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
    <fixed facet="wst.jsdt.web"/>
    <installed facet="java" version="1.6"/>
    <installed facet="jst.web" version="2.4"/>
    <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

和现在:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
    <fixed facet="java"/>
    <fixed facet="jst.webfragment"/>
    <installed facet="java" version="1.6"/>
    <installed facet="jst.webfragment" version="3.0"/>
</faceted-project>

覆盖该文件并假设其他所有内容是否正确仍然按设计工作(这里指的是 Eclipse)?我注意到 Eclipse 现在在“部署程序集”中建议了一个 JAR 文件并创建了它,但仅仅因为它正在工作并不一定意味着我没有破坏其他任何东西。

I decided to split a dynamic web application into two dynamic web applications, a core part and project specific part. If I run maven I get a JAR-file for the core-project due to its pom.xml.

However, with WTP I don't seem to be able to convince Eclipse to deploy the core project as a JAR-file. If I edit the target filename in the project's "Deployment Assembly" from blah.war to blah.jar, close and reopen the project properties it's a WAR-file again.

So I decided to try to make the core project a web fragment module (I hadn't noticed it when I split the original project). If I deselect "Dynamic Web Module" and select "Web Fragment Module" in the project facets I'm not allowed to click "Apply" or "OK" as they are greyed out.

What do I do now? In the end I want WTP to write a JAR-file of the core project to the lib-folder of the web-app.


EDIT:

I created a new Web Fragment Project and tried to find the obvious differences to my dynamic web project. The only obvious difference was in .settings/org.eclipse.wst.common.project.facet.core.xml as it was

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
    <fixed facet="wst.jsdt.web"/>
    <installed facet="java" version="1.6"/>
    <installed facet="jst.web" version="2.4"/>
    <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

and is now:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
    <fixed facet="java"/>
    <fixed facet="jst.webfragment"/>
    <installed facet="java" version="1.6"/>
    <installed facet="jst.webfragment" version="3.0"/>
</faceted-project>

Is it correct to overwrite that file and assume everything else is still working as designed (speaking of Eclipse here)? I noticed that Eclipse now suggests a JAR-file now in the "Deployment Assembly" and also creates it, but just because that is working doesn't necessarily mean that I didn't break anything else.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻泪 2024-11-03 09:09:44

因为我没有遇到任何问题,也没有人争论,所以我想我所描述的这样做的方法是有效的。

Since I haven't had any problems and nobody argued I guess my described way of doing this has worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文