1. 程式人生 > >使用maven整合多個web專案,多個war合併

使用maven整合多個web專案,多個war合併

              再執行mvn package -f pom-all.xml 即可

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sharp</groupId>
  <artifactId>mvc1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>mvc1</name>
  <dependencies>
  	<dependency>
  		<groupId>com.sharp</groupId>
  		<artifactId>mvc4</artifactId>
  		<version>0.0.1-SNAPSHOT</version>
  		<type>war</type>
  		<scope>runtime</scope>
  	</dependency>
  </dependencies>
  
  <build>
	<plugins>
		<plugin>
			<artifactId>maven-war-plugin</artifactId>
			<version>2.1.1</version>
			<configuration>
				<warSourceDirectory>src/main/webapp</warSourceDirectory>
				<overlays>
					<overlay>
						<groupId>com.sharp</groupId>
						<artifactId>mvc4</artifactId>
						<excludes>
							<exclude>WEB-INF/lib/*</exclude>
							<exclude>WEB-INF/web.xml</exclude>
						</excludes>
					</overlay>
				</overlays>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty-maven-plugin</artifactId>
			<version>8.1.15.v20140411</version>
			<configuration>
				<scanIntervalSeconds>10</scanIntervalSeconds>
				<webAppConfig>
					<contextPath>/mvc3</contextPath>
				</webAppConfig>
			</configuration>
		</plugin>
	</plugins>
  </build>
</project>