Overwriting resources during maven war overlay
As I've gathered, maven-war-plugin
never overwrites files which already exist in the target of an overlay. For example, if I have a war
A which has a dependency on a war
B, both of which conta开发者_Go百科in some resource located at src/main/resources/some.xml
, the resulting A.war
will contain the some.xml
from the A project.
How do I instruct the maven-war-plugin
to favor the resources from the dependency (B) over the original ones (A)?
See http://maven.apache.org/plugins/maven-war-plugin/overlays.html:
"For instance if the index.jsp file of the overlay my-webapp must be set in the webapp but other files can be controlled the regular way, define two overlay configurations for my-webapp"
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay>
<id>my-webapp-index.jsp</id>
<groupId>com.example.projects</groupId>
<artifactId>my-webapp</artifactId>
<includes>
<include>index.jsp</include>
</includes>
</overlay>
<overlay>
<!-- empty groupId/artifactId represents the current build -->
</overlay>
...
</overlays>
</configuration>
Guess that's not the final desicion, but a point to start at.
You can use maven-resources plugin to copy a file to the desired location. Before or after a war has been built.
精彩评论