Maven 的聚合

1.maven的集合

1.假设我们已经拥有了项目Age,项目Bge,项目Cge,项目Summary

2.我们在项目Summary的pom.xml中引入集合标签(以项目Summary汇总)

<modules>

    <module>../引入的项artifactId</module>

    <module>../引入的项artifactId</module>

</modules>

例子:

Summary的pom.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.imooc.Summary</groupId>
  <artifactId>Summary</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>Summary</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  
  <modules>
          <module>../Age</module>
          <module>../Bge</module>
          <module>../Cge</module>
  </modules>
</project>

作用:项目Summary执行install  ,clean  ,compile,test时,存在module中的项目会一起执行这一个命令

猜你喜欢

转载自www.cnblogs.com/yvanBk/p/9076485.html