如何解决Cannot resolve org.springframework.boot:spring-boot-starter-parent:3.1.5
时间: 2023-11-30 18:02:31 浏览: 147
根据提供的引用内容,出现Cannot resolve org.springframework.boot:spring-boot-starter-parent:3.1.5的错误是因为没有正确引入spring-boot-starter-parent依赖的版本号管理。解决这个问题有两种方法:
1.在父pom的<dependencyManagement>标签中加入依赖的版本号管理,具体步骤如下:
- 找到你引入依赖的版本号,可以在spring-boot-starter-parent中找到。
- 在父pom的<dependencyManagement>标签中加入依赖的版本号管理,例如:
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
```
2.直接在需要的模块的pom中引入spring-boot-starter-parent依赖,具体步骤如下:
- 在需要的模块的pom中添加spring-boot-starter-parent依赖,例如:
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
```
- 或者直接继承spring-boot-starter-parent,例如:
```xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
</parent>
```