Intellij IDEA 中 spring 关键字的红色

son*_*gmo 6 java intellij-idea spring-boot-maven-plugin

我无法解决IntelliJ IDEA中以红色突出显示的Spring Boot leyword问题。我在IntelliJ中使用了无效缓存和同步选项,但这并没有解决问题。

错误的图像

pom.xml

悬停错误图像

POM.xml

<?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.1.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>12</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</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>
Run Code Online (Sandbox Code Playgroud)

小智 3

我有同样的问题。我插入了这一行:

<version>2.4.1</version>
Run Code Online (Sandbox Code Playgroud)

在下面

<artifactId>spring-boot-maven-plugin</artifactId>
Run Code Online (Sandbox Code Playgroud)

行,然后加载 Maven 更改(当弹出蓝色小 Maven 图标时),红色文本变成白色(灰色等),现在看起来没问题。

在按上述方式放置之前,请务必检查您的版本。请参考以下步骤。转到 IDE 左上角的 maven 表。然后单击插件并找到如下所附图片中的版本。行家图标 找到插件版本