Maven聚合和继承

一. 聚合

1. 聚合的目的:一次构建多个模块和项目。

2. 聚合的packaging为POM,聚合下的module的值都是一个当前POM的相对目录。

3. 对于聚合模块来说,它知道哪些被聚合的模块,但是那些被聚合的模块并不知道聚合模块的存在。

聚合的例子如下:

<groupId>com.account</groupId>

<artifactId>accout-aggregator</artifactId>

<packaging>pom</packaging>

<name>testName</name>

<modules>

    <module>module1</module>

    <module>module2</module>

</modules>

 

 

二. 继承

1. 继承的目的: 减少重复,重用一些公用的配置,如依赖,版本号,plugin 等等。

2. 继承的pom的packaging类型也为pom。

3. 在子pom中引用parent,其中groupId,artifactId 和version是必须的

   

<parent>
   <groupId>parent groupid</groupId>
   <artifactId>parent artifactid</artifactId>
   <version>parent version</version>
   <relativePath>parent pom path</relativePath>
</parent>

 4. 对于继承的父pom来说,它不知道有哪些子模块继承于它,但是那些子模块都必须知道自己的父pom是什么。

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值