1.首先配置依赖:
dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>jeewx-test-web</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
这里type一定要指定war.
然后在build节点内指定plugin如下:
<!-- 合并多个war -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
<overlays>
<overlay>
<groupId>org.jeecgframework</groupId>
<artifactId>jeewx-test-web</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
其他参考:
<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> <!-- 那些文件可以忽略不,整合的时候不会将SettleAccountsModel文件整合进war中 -->
<exclude>**/web.xml</exclude>
<exclude>**/config/</exclude>
<exclude>**/lib/</exclude>
<exclude>**/com/chinarb/entity/</exclude>
</excludes>
</overlay>
<overlay..><!-- 其他的war项目 -->
</overlays>
</configuration>
</plugin>
</plugins>
</build>
如果war中有的文件是不会覆盖掉,所以如果war中文件相同.overlay节点之后的内容是无法覆盖之前的.
使用这个技术可以完成 war单独运行,也可打包运行
采用eclipse启动命令: tomcat:run-war