首先創建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>