Q:

Duplicated context.xml in Maven project

I've got the following project structure:
src/
  main/
    java/
      ...
    resources/
      META-INF/
        context.xml
        persistence.xml
    webapp/
      WEB-INF/
        web.xml
        ...
      ...
  test/
    ...

pom.xml (specifically, build part) looks like this:
<build>
<finalName>...</finalName>

<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
  </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
      <containerConfigXML>src/main/resources/META-INF/context.xml</containerConfigXML>
    </configuration>
  </plugin>
</plugins>
</build>

The trouble is that context.xml gets doubled in the resulting WAR.  It appears in

/META-INF - that's the right place for it, and
/WEB-INF/classes/META-INF.  I see it gets copied here from the resources folder, as any other resource. 

Application deploys flawlessly, but this duplication really bothers me.  What's wrong with my setup? 

A:

Add a <resources> element under <build>, and explicitly exclude the file. 
<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
            <exclude>META-INF/context.xml</exclude>
        </excludes>
    </resource>
</resources>

