首先创建maven project 将pom.xml中<packaging>jar</packaging>改为<packaging>pom</packaging>
否则创建Maven Module会报错
The parent project must have a packaging type of POM
创建Maven Module会自动在pom中加入依赖
<modules>
<module>common</module>
</modules>
如果有多个web项目需要合并war包
在总的项目中加入plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<overlays>
<overlay>
<groupId></groupId>
<artifactId></artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
在总的web的pom加入要合并的war的依赖
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<type>war</type>
</dependency>
查看生成的war就是多个合并后的内容了
如果多个war有同路径且同名的文件,总的web里有的会覆盖分支的,总的没有看合并顺序留下第一个文件的
加入jetty
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
<configuration>
<httpConnector>
<port>8080</port>
<host>localhost</host>
</httpConnector>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>