我没有找到如何通过覆盖解决问题。所以我不得不使用两个插件maven-dependency-plugin和maven-war-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mygroup</groupId>
<artifactId>my_comp</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/tmp</outputDirectory>
<includes>WEB-INF/folder1/folder2/file.xml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}/tmp/WEB-INF/folder1/folder2</directory>
<targetPath>WEB-INF/otherFolder</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
附加到流程资源阶段的第一个插件。当所有叠加层组合时,第二个在阶段包上调用。覆盖以先赢策略应用(因此,如果文件已被覆盖复制,它将不再被复制)如果我复制了我的 file.xml(通过插件),那么它不会被任何覆盖覆盖.
太复杂了!