Search code examples
javamavenwarmaven-war-plugin

maven-war-plugin overlay removes /META-INF/context.xml


There are 3 maven projects:

  • my-overlay (its a blueprint-war for an overlay only containing the context.xml)
  • my-base (its a pom to use in the scope of real war)
  • my-webapp (the final project to use in production as a child-project of the my-base)

I have the my-overlay as a maven project packed as war:

+ my-overlay
  + src
    + main
      + webapp
        + META-INF
          + context.xml
        + hello.jpg
  + pom.xml

The final my-overlay.war contains the /META-INF/context.xml and the /hello.jpg.

Now i have another project

+ my-base
  + pom.xml

having this xml in the pom.xml:

<packaging>pom</packaging>
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <overlays>
          <overlay>
            <id>my-overlay</id>
            <excludes /> <!-- remove the exlude of /META-INF/ -->
          </overlay>
          <overlay></overlay>
        </overlays>
      </...>

And i have a third maven-project:

+ my-webapp
  + main
    + webapp
      + index.jsp
  + pom.xml

Having this in the pom.xml:

<parent> ... my-base ...</parent>
<packaging>war</packaging>

So if i build the my-webapp project using mvn install, the overlay support the hello.jpg but not the context.xml. But i removed the default-exclude in the overlay.

What to do to let the overlay support the META-INF/context.xml?

By the way: Suprisingly the my-webapp/target/war/work/mygroup/my-overlay/META-INF/context.xml exists!


Solution

  • Blocker-Bug Confirmed, prepared for 3.0.0

    https://issues.apache.org/jira/browse/MWAR-367