I want to simply merge two WAR files, overwriting corresponding files in first WAR with files from second WAR i.e. output WAR will contain web.xml from second WAR if one was present there. I am trying to use cargo-maven2-plugin but I have problems with that. Cargo has some sophisticated mechanism for merging web.xml and in most cases the result is different from that what I need.
I tried some uberwar configurations similar to following ones:
1)
<uberwar>
<wars>
<war>com.xyz:core-module</war>
<war>com.xyz:core-extension-module</war>
</wars>
<merges>
<merge>
<type>web.xml</type>
<parameters>
<default>
<tag name="servlet">
<strategy name="Overwrite" />
</tag>
<tag name="servlet-mapping">
<strategy name="Overwrite" />
</tag>
</default>
</parameters>
</merge>
</merges>
</uberwar>
2)
<uberwar>
<wars>
<war>com.xyz:core-module</war>
<war>com.xyz:core-extension-module</war>
</wars>
<merges>
<merge>
<type>web.xml</type>
<parameters>
<default>
<tag name="servlet">
<strategy name="NodeMerge">
<servlet>
<servlet-name>$left:servlet-name</servlet-name>
<servlet-class>$right:servlet-class</servlet-class>
</servlet>
</strategy>
</tag>
<tag name="servlet-mapping">
<strategy name="NodeMerge">
<servlet-mapping>
<servlet-name>$left:param-name</servlet-name>
<url-pattern>$right:param-value</url-pattern>
</servlet-mapping>
</strategy>
</tag>
</default>
</parameters>
</merge开发者_如何学运维>
</merges>
</uberwar>
In both cases I do not get what I want or even something similar to that what I want. Do you have any idea what I am doing wrong? Or maybe Cargo isn't a good tool for that... do you know any other tools that could do same thing and could be integrated with Maven? Thanks.
This can be accomplished using the Maven War Plugin. If the overlays order isn't declared the order of the war overlaying appens in the same order the dependencies are declared.
To get full control of the overlay the overlays element should be used.
精彩评论