1. 程式人生 > 其它 >maven中需要合併的依賴

maven中需要合併的依賴

maven中需要合併的依賴:

<?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.sishuok</groupId>
  <artifactId>architecture1web
</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>architecture1web Maven Webapp</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <!--在總的web的pom裡面, 加入要合併的war的依賴-->
<dependency> <groupId>com.sishuok</groupId> <artifactId>customerMgr</artifactId> <version>1.0-SNAPSHOT</version> <type>war</type> </dependency> <dependency> <groupId>com.sishuok</groupId> <artifactId>goodsMgrWeb</artifactId> <version>1.0-SNAPSHOT</version> <type>war</type> </dependency> <dependency> <groupId>com.sishuok</groupId> <artifactId>cartMgr</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>com.sishuok</groupId> <artifactId>orderMgr</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>com.sishuok</groupId> <artifactId>storeMgr</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>architecture1web</finalName> <plugins> <!--在總的web的pom裡面, 加入要合併的war內容-->
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.2.3</version> <configuration> <!--overlays: 把所有需要合併得war配置進來--> <overlays> <overlay> <groupId>com.sishuok</groupId> <artifactId>customerMgr</artifactId> </overlay> <overlay> <groupId>com.sishuok</groupId> <artifactId>goodsMgrWeb</artifactId> </overlay> <overlay> <groupId>com.sishuok</groupId> <artifactId>cartMgr</artifactId> </overlay> <overlay> <groupId>com.sishuok</groupId> <artifactId>orderMgr</artifactId> </overlay> <overlay> <groupId>com.sishuok</groupId> <artifactId>storeMgr</artifactId> </overlay> </overlays> </configuration> </plugin> </plugins> </build> </project>

 

獨立模組的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">
    <parent>
        <artifactId>architecture1</artifactId>
        <groupId>com.sishuok</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sishuok</groupId>
    <artifactId>customerMgr</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>customerMgr Maven Webapp</name>
    <url>http://www.example.com</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.sishuok</groupId>
            <artifactId>comm</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>customerMgr</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>