多maven工程依赖写法注意问题

本文介绍如何在Maven项目中使用父子模块进行依赖管理,包括如何在父模块中定义通用依赖版本,以及如何在子模块中引用这些依赖而不必指定版本号。此外,还介绍了当子模块不依赖于父模块时如何保持版本一致性。
1 依赖jar写法注意版本
在父maven中定义好
<dependency>
 <groupId>com.fomoney</groupId>
 <artifactId>performance-monitoring</artifactId>
 <version>${performance-monitoring.version}</version>
</dependency>


      <performance-monitoring.version>1.0.3-SNAPSHOT</performance-monitoring.version>
子工程不需要写版本
<dependency>
 <groupId>com.fomoney</groupId>
 <artifactId>performance-monitoring</artifactId>
</dependency>

2 另外 父pom依赖依赖


  <parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>1.5.4.RELEASE</version>
    </parent>

所有的子工程里面的jar的版本要和spring-boot 1.5.4.RELEASE 保持一致
具体文件地址
C:\Users\Administrator\.m2\repository\org\springframework
\boot\spring-boot-dependencies\1.5.4.RELEASE
    
对于子pom文件如下依赖的版本 也不需要版本号
<dependency>
  <groupId>javax.servlet</groupId> 
  <artifactId>javax.servlet-api</artifactId>  
</dependency>
对于一些独立项目 不需要依赖父pom的需要写版本号的,保本好要和上面文件的版本
保持一致 (C:\Users\Administrator\.m2\repository\org\springframework
\boot\spring-boot-dependencies\1.5.4.RELEASE)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值