首页 > 解决方案 > 项目 'org.springframework.boot:spring-boot-starter-parent:2.4.0' 未找到

问题描述

我正在关注本指南:https ://spring.io/guides/gs/serving-web-content/ ,

<?xml version="1.0" encoding="UTF-8"?>
<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 http://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.4.0</version>
        <relativePath/>
    </parent>

    <groupId>org.example</groupId>
    <artifactId>plats-bruts</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>

但我在 pom 上有这个问题:

Project 'org.springframework.boot:spring-boot-starter-parent:2.4.0' not found

但它在这里https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/2.4.0

标签: javaspringspring-bootmavenpom.xml

解决方案


我刚刚遇到了类似的问题。我正在使用 IntelliJ IDEA Ultimate 2020.2。版本号 2.4.0 是红色的,消息和你的一样。

选择 File -> Invalidate Caches / Restart... 并选择 Invalidate and Restart 选项解决了这个问题。我想这只是一个陈旧的缓存。


推荐阅读