<!--统一管理jar版本-->
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.12</junit.version>
<!- 使用最新版本的log4j , 防止安全漏洞-->
<log4j.version>2.17.2</log4j.version>
<lombok.version>1.18.20</lombok.version>
<mysql.version>5.1.47</mysql.version>
<druid.version>1.1.17</druid.version>
<mybatis.spring.boot.version>2.2.0</mybatis.spring.boot.version>
</properties>
<!--配置项目相关依赖 锁定版本-->
<dependencyManagement>
<dependencies>
<!--配置druid数据源-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!--配置springboot整合mybatis starter-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.spring.boot.version}</version>
</dependency>
<!--配置log4j ,使用的最新高版本-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
这个原因是,你本地maven仓库,没有这个版本号的jar包依赖,所以爆红
但是,为什么不报错了
因为这里是
dependencyManagement管理的依赖
它的作用和dependencies是有区别的
前者,类似于定义好,用于子包引用依赖的时候,直接写上依赖,不需要写版本号
没有子包引用,则不会下载jar包
后者,是直接下载jar包关联到项目中
解决办法:
先把外层的dependencyManagement删掉,先用dependencies把这些下载下来,然后,再给dependencies加上dependencyManagement
此时,就不在爆红了。
7446

被折叠的 条评论
为什么被折叠?



