maven如何合并两个war到一个war项目中

  1. 首先配置依赖:

1
2
3
4
5
6
< dependency >
             < groupId >com.chinarb.new groupId >
             < artifactId >RBManagerNew-SettleAccountsModel artifactId >
             < version >1.0 version >
             < type >war type >
         dependency >

这里type一定要指定war.

然后在build节点内指定plugin如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
< build >
     < plugins >
         < plugin >
             < groupId >org.apache.maven.plugins groupId >
                 < artifactId >maven-war-plugin artifactId >
                 < version >2.4 version >
                 < configuration >
                     < overlays >
                         < overlay >
                             < groupId >com.chinarb.new groupId >
                             < artifactId >RBManagerNew-SettleAccountsModel artifactId >
                             < excludes
                                 < exclude >**/web.xml exclude >
                                 < exclude >**/config/ exclude >
                                 < exclude >**/lib/ exclude >
                                 < exclude >**/com/chinarb/entity/ exclude >
                             excludes >
                         overlay >
                         < overlay.. >
                     overlays >
                 configuration >
         plugin >
     plugins >
build >

如果war中有的文件是不会覆盖掉,所以如果war中文件相同.overlay节点之后的内容是无法覆盖之前的.

使用这个技术可以完成 war单独运行,也可打包运行


你可能感兴趣的:(maven)