maven使用笔记--在父pom中声明过的jar可以被继承,使子项目不用写版本号由父pom控制

将dependencies放到dependencyManagement中,如下:        

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. <dependencyManagement>  
  2.     <dependencies>  
  3.         <dependency>  
  4.             <groupId>junit</groupId>  
  5.             <artifactId>junit</artifactId>  
  6.             <version>4.9</version>  
  7.             <scope>test</scope>  
  8.         </dependency>  
  9.     </dependencies>  
  10. </dependencyManagement>  
  11.  那么,子模块在使用到junit的时候,只需要声明groupId和artifactId即可,即:

    [html]  view plain copy 在CODE上查看代码片 派生到我的代码片
    1. <dependencies>  
    2.     <dependency>  
    3.         <groupId>junit</groupId>  
    4.         <artifactId>junit</artifactId>  
    5.     </dependency>  
    6. </dependencies>  

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值