Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-wtp-dev] (Undocumented) behaviour of wb-resource publishing

Following today's call, I've opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=448544

Regards,

Fred Bricon

On Thu, Oct 23, 2014 at 1:03 PM, Fred Bricon <fbricon@xxxxxxxxx> wrote:
Hello World,

m2e-wtp supports one of Maven's features known as resource filtering for web [1] and ear [2] projects. Some files contain placeholders that are replaced by Maven, during a build, with actual values. 
Typically, we could have a web.xml file containing 

<web-app>

    <context-param>

     <param-name>javax.faces.PROJECT_STAGE</param-name>

     <param-value>${jsf.project.stage}</param-value>

    </context-param>

...

</web-app>


with filtering enabled and a jsf.project.stage property set to either Development or Production in pom.xml, that would generate a (filtered) web.xml in target/m2e-wtp/web-resources/META-INF/ like

<web-app>

    <context-param>

     <param-name>javax.faces.PROJECT_STAGE</param-name>

     <param-value>Development</param-value>

    </context-param>

...

</web-app>


A similar mechanism exists to filter resources in EAR projects, where filtered resources end up under  target/m2e-wtp/ear-resources/.

Now, in order to publish the filtered version of these files, instead of the raw, unfiltered one, m2e-wtp relies on a kind of undocumented behaviour : in  .settings/org.eclipse.wst.common.component, the folder containing generated files is declared *first* : 

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">

    <wb-module deploy-name="index-ear">

        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/ear-resources"/>

        <wb-resource deploy-path="/" source-path="/src/main/application" tag="defaultRootSource"/>

         ...

    </wb-module>

</project-modules>

So when files are duplicated in different wb-resources, the first one found wins. At least this is true for JBoss, Tomcat, Glassfish server adapters.

Now, it turns out IBM Websphere server adapter does the opposite, last file wins, which is a problem [3] because unfiltered files end up being served.

Soooo, I would like the WTP to document what is the expected behaviour of publishing conflicting resources from several wb-modules. I would reaaaally like to avoid adding one more hack to m2e-wtp to handle these opposite behaviours.
Which would give us 2 options :
1 - If it's explicitely said first resource wins, then IBM will need to fix their server adapter.
2 - If the last resource should win, then m2e-wtp and all the adapters for these open source servers would have to be fixed

Needless to say, I'm strongly in favour of option #1 :-)

I should attend today's WTP call, if anyone wants to discuss that.

Regards,

Fred Bricon 


[1] https://bugs.eclipse.org/437441

--
"Have you tried turning it off and on again" - The IT Crowd



--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top