[Error] When IDEA was building SpringBoot, MVN reported an error that the plug-in'org.springframework.boot:spring-boot-maven-plugin:' was not found

[Error] When IDEA was building SpringBoot, MVN reported an error that the plug-in'org.springframework.boot:spring-boot-maven-plugin:' was not found

1. Description of error scene

When using IDEASpring Initailizr to create a SpringBoot project, the Spring-boot-maven-plugin plug-in is marked red in pom.xml after the project is created.

The mvn console reported an error that the plug-in'org.springframework.boot:spring-boot-maven-plugin:' was not found

Insert picture description here


2. The problem is locked

First of all, according to the function of SpringBoot, that is, when importing the parent project dependency, the corresponding dependency is automatically imported, without considering the version dependency of each dependency and plug-in. But here is the red certificateThe plug-in is not bundled with a good version


3. Solution

According to the problem lock, I learned that the problem is that the plug-in does not have a binding version, so you only need to add the version number binding in the corresponding pom.xml file. According to the version dependency of SpringBoot, you only need to bind the version of the corresponding parent project to solve the problem. problem.

<!-- 父项目依赖处得到版本号 -->
	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
...

...
<!-- 在对应插件处绑定版本号 -->
	<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
<!-- 这里 -->   <version>2.4.4</version>
            </plugin>
        </plugins>
    </build>

Reload the Maven warehouse, you can find that the place is no longer marked in red,problem solved

Guess you like

Origin blog.csdn.net/weixin_44818370/article/details/115294435