No plugin found for prefix spring-boot in the current project and in the plugin groups 异常解决

一. 异常问题

我在intellij idea中通过mvn spring-boot:run命令来启动springboot项目的时候,结果产生如下图所示的异常信息:

异常现象

 

[ERROR] No plugin found for prefix 'spring-boot' in the current 

project and in the plugin groups [org.apache.maven.plugins, 

org.codehaus.mojo] available from the repositories [local (C:\MavenRepository), central 

(https://repo.maven.apache.org/maven2)] -> [Help 1]

 

二. 原因分析

产生该问题的原因大致有如下三种:

1. pom.xml文件里少了parent依赖,代码如下:

1
2
3
4
5
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.7.RELEASE</version>
 </parent>

这种错误一般不会存在。

2. 缺少如下代码:

1
2
3
4
5
6
7
8
9
10
11
12
<repositories>
    <repository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
</pluginRepositories>

3. 运行mvn spring-boot:run 命令时的路径不对:

If you are running the mvn spring-boot:run from the command line, 

make sure you are in the directory that contains the pom.xml file. 

Otherwise, you will run into the No plugin found for prefix ‘spring-

boot’ in the current project and in the plugin groups error.

意思是: 在命令行运行 mvn spring-boot:run 时,一定要确保你是运行在该pom.xml文件所在的路径下,不然就会出现 No plugin found for prefix 'spring-boot' in the current project and in the plugin groups 这种错误。

三. 解决办法

大多数人都是这个原因,只要切换到pom.xml文件所在的目录下运行mvn spring-boot:run 就顺利启动了。

 

posted @   小旭的blog  阅读(5412)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2020-10-10 pytest学习(三) - fixture(一)
2017-10-10 ios下虚拟键盘出现"搜索"字样
点击右上角即可分享
微信分享提示