问题描述
我无法使Eclipse正确地将覆盖的WAR发布到weblogic服务器。运行maven clean包正确地汇编了EAR,导入了正确的webapp内容。我发现了几个类似的问题,但没有一个似乎是最近的或同样的问题。
I'm having trouble getting Eclipse to properly publish overlayed WARs locally to a weblogic server. Running a maven clean package correctly assembles the EAR with the proper webapp content imported. I've found several similar questions but none appear to be recent or the same issue.
查看我的org.eclipse.wst.common.component文件,也正确生成覆盖资源的依赖模块。
Looking in my org.eclipse.wst.common.component file, the dependent-module for the overlay resource is correctly generated, as well.
我使用的是m2e-wtp 1.0.1.20130911-1545
I'm using m2e-wtp 1.0.1.20130911-1545
有没有额外的配置,我需要为了让服务器发布读取该重叠?
Is there additional configuration that I need to do to get the server publishing to read that overlay?
使用更多信息编辑:
这里是从WARs pom.xml的摘录
Editing with more info:Here is the excerpt from the WARs pom.xml
<dependencies>
<dependency>
<groupId>com.abc</groupId>
<artifactId>core-webcontent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<overlays>
<overlay>
<groupId>com.abc</groupId>
<artifactId>core-webcontent</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
以下是组件文件的摘录
<dependent-module deploy-path="/" handle="module:/overlay/prj/core-webcontent?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
我尝试在本地对EAR进行导出,以便我可以查看EAR并查看文件被添加到不同的位置,但似乎根本不适用于这种类型的设置。
I tried doing an export on the EAR locally so that I could view the EAR and see if the files are being added to a different location, but it seems that does not work at all from this type of setup.
推荐答案
我试过在JBoss AS 7.x / Wildfly 8.w没有任何问题。我下载了Weblogic来尝试(我从来没有使用过),我可以确认你看到的行为。
I tried on JBoss AS 7.x/Wildfly 8.w without any problem. I downloaded Weblogic to try (I never used it) and I can confirm the behavior you see.
问题是由Weblogic直接从工作空间位置提供文件引起的。这是同样的问题,防止重叠式工作的Tomcat的。基本上由m2e-wtp提供的覆盖组件在直接从源代码服务时被忽略。
The problem is caused by Weblogic serving files directly from the workspace location. This is the same problem that prevents overlay from working for Tomcat's "Serve without publishing" mode. Basically the overlay components provided by m2e-wtp are ignored when serving the webapps directly from source.
JBoss服务器和Tomcat的默认模式支持重叠,因为webapp被发布到另一个位置并从那里提供。该发布步骤允许添加,然后提供重叠的文件。
JBoss Servers and Tomcat's default mode support overlays because the webapp is published to another location and served from there. That publishing step allows to add, then serve, the overlaid files.
以下更改允许Weblogic执行相同操作:
*在服务器视图中,删除您的weblogic服务器上的EAR
*右键单击weblogic服务器并打开属性对话框
*转到Weblogic>发布
*选择作为爆炸档案发布,然后按OK
*在Weblogic服务器上重新部署您的EAR
The following changes allow Weblogic to do the same :* in the servers view, remove the EAR from your weblogic server* right-click on the weblogic server and open the Properties dialog* Go to Weblogic > Publishing* Select "Publish as an exploded archive" and press OK* Re-deploy your EAR on the weblogic server
现在应该从[workspace / path] /。metadata / .plugins / org.eclipse提供。 core.resources / .projects / [earproject] / beadep / [domain] / [earproject] /
It should now be served from [workspace/path]/.metadata/.plugins/org.eclipse.core.resources/.projects/[earproject]/beadep/[domain]/[earproject]/
我注意到有一件事是,重叠的项目的变化不是立即公布。您需要在主webapp中进行一些虚拟更改以查看覆盖文件的部署。
One thing I noted though, is changes from the overlaid project are not published immediately. You need to do some dummy change in the main webapp to see the overlay files be deployed.
在这一点上,如果您想要更好地支持weblogic工具中的覆盖您需要联系到Oracle。
at this point, if you want to see better support for overlays in weblogic tooling, you need to reach out to Oracle.
这篇关于m2e-wtp覆盖不加载到Eclipse发布的EAR或WAR文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!