1 回答

TA貢獻1862條經(jīng)驗 獲得超7個贊
您需要在此處使用戰(zhàn)爭疊加層,這是一個示例:
父 pom,將所有子項目放在一起:
<?xml version="1.0" encoding="UTF-8"?>
<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.greg</groupId>
<artifactId>war-overlay-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>base-war</module>
<module>dist1-war</module>
</modules>
</project>
對于任何常見的東西,該項目的基礎(chǔ)戰(zhàn)爭:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.greg</groupId>
<artifactId>war-overlay-example</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>base-war</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>base-war</finalName>
</build>
</project>
和許多分銷戰(zhàn)爭改變基地戰(zhàn)爭中的任何事情。此項目中包含的任何內(nèi)容都將替換基礎(chǔ)戰(zhàn)爭中的任何內(nèi)容。您可以一無所有并獲得完整的基礎(chǔ)戰(zhàn)爭或插入單個文件。
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.greg</groupId>
<artifactId>war-overlay-example</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>dist1-war</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.greg</groupId>
<artifactId>base-war</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>dist1-war</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<overlays>
<overlay>
<groupId>com.greg</groupId>
<artifactId>base-war</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>
這里的工作示例
添加回答
舉報