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依賴,代碼如下:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.7.RELEASE</version>
 </parent>

這種錯誤一般不會存在。

2. 缺少如下代碼:

<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 就順利啟動了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM