pom.xml中引入一下代码会覆盖引入jar的版本
<dependencyManagement>
<dependencies>
<dependency>
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>xxx</version>
<scope>xxx</scope>
</dependency>
</dependencies>
</dependencyManagement>
比如需要在Springboot项目中使用spring-messaging 这个5.2.6.RELEASE版本的的jar信息。原来SpringBoot中已存在4.3.4这个版本。那么我们只需要这么做即可
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>5.2.6.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
compile:默认值,表示当前依赖包,要参与当前项目的编译,后续测试,运行时,打包
provided:代表在编译和测试的时候用,运行,打包的时候不会打包进去
test:表示当前依赖包只参与测试时的工作:比如Junit
runtime:表示当前依赖包只参与运行周期,其他跳过了
system:从参与度和provided一致,不过被依赖项不会从maven远程仓库下载,而是从本地的系统拿。需要
systemPath属性来定义路径