No plugin found for prefix 'spring-boot' ...的问题解决方法

我在出初学spring boot时,用idea启动项目没问题,但是用maven启动项目时报错信息如下:

[ERROR] No plugin found for prefix 'spring-boot' in the current project and in t
he plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from th
e repositories [local (C:\Users\Administrator\.m2\repository), alimaven (http://
maven.aliyun.com/nexus/content/groups/public/)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundF
orPrefixException。

国类论坛关于此问题的讨论甚少,之后在国外IT论坛StrackOverflow上找到了解决方法,主要有三种原因:
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 就顺利启动了。

现在spring boot报错在国内论坛不太容易找到答案,建议大家多用Google,多看外国论坛,英语不好没关系,用百度翻译慢慢看,不要怕,这是成为优秀程序员的必经之路。

  • 36
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 22
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值