未找到项目“org.springframework.boot:spring-boot-starter-parent:2.4.0”

en *_*pes 17 java spring pom.xml maven spring-boot

我正在遵循本指南: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>
Run Code Online (Sandbox Code Playgroud)

但我在 pom 上有这个问题:

Project 'org.springframework.boot:spring-boot-starter-parent:2.4.0' not found
Run Code Online (Sandbox Code Playgroud)

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

小智 84

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

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

  • 你救了我的命! (2认同)
  • 嗯...这对我没有帮助:( IntelliJ IDEA 2021.3.2(社区版) (2认同)