降级Spring Boot版本

将 Spring Boot 依赖从3.3.1降级到 2.5.6 版本,并删除错误的版本依赖。

步骤1:删除本地 Maven 仓库中的旧版本

首先,确保本地 Maven 仓库中没有错误的 Spring Boot 版本。手动删除以下目录:
C:\Users\Administrator\.m2\repository\org\springframework\boot\spring-boot\3.3.1\

步骤2:确保 pom.xml 文件中的 Spring Boot 版本正确

确保你的 pom.xml 文件中所有 Spring Boot 相关依赖都使用 2.5.6 版本:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>hello-world</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>hello-world</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

步骤3:清理并重新构建项目

1.清理项目:
        打开终端或命令提示符,导航到项目根目录,运行以下命令清理项目:
    mvn clean
2.重新下载并构建项目:

    运行以下命令重新下载依赖并构建项目:mvn compile

步骤4:确保 IntelliJ IDEA 的项目和模块配置正确

    1.打开项目结构设置:
        在 IntelliJ IDEA 中,点击 File -> Project Structure。

    2.设置 Project SDK:
        在 Project 选项卡中,确保 Project SDK 设置为 JDK 1.8。
        确保 Project language level 设置为 8 - Lambdas, type annotations etc.。

   3. 检查模块 SDK 设置:
        在 Modules 选项卡中,选择项目模块。
        确保每个模块的 SDK 设置为 Project SDK (1.8)。
        在 Language level 中,确保设置为 8 - Lambdas, type annotations etc.。

    4.检查编译器设置:
        点击 File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler。
        确保 Project bytecode version 设置为 1.8。

  • 6
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值