m2e-wtp Overlay not loading into Eclipse-published

2019-05-29 04:13发布

问题:

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.

Looking in my org.eclipse.wst.common.component file, the dependent-module for the overlay resource is correctly generated, as well.

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?

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>

Here is the excerpt from the component file

<dependent-module deploy-path="/" handle="module:/overlay/prj/core-webcontent?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
    <dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
    <dependency-type>consumes</dependency-type>
</dependent-module>

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.

回答1:

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.

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 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.

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

It should now be served from [workspace/path]/.metadata/.plugins/org.eclipse.core.resources/.projects/[earproject]/beadep/[domain]/[earproject]/

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.

at this point, if you want to see better support for overlays in weblogic tooling, you need to reach out to Oracle.