mvn spring-boot:run出错No plugin found for prefix 'spring-boot'

本文介绍了在使用SpringLoader进行项目热部署时遇到的`spring-boot:run`命令找不到插件错误。错误原因是spring-boot-maven-plugin的jar包未成功下载。解决方法包括在mvnrepository.com网站上重新下载对应版本的jar包,并确保spring-boot-maven-plugin和springloaded的版本一致。更新pom.xml文件后,问题得到解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用 SpringLoader 进行项目的热部署
以 maven 插件方式使用 SpringLoader
在 pom 文件中添加插件配置文件中添加插件配置

使用 maven 的命令spring-boot:run来启动::

首先运行Spring-boot的启动类,且不能停止它启动,然后在项目名上鼠标右键单击,选择run as->maven build(第二个)->在goals框中输入spring-boot:run命令,点击run按钮,启动springLoader时发生以下错误:

[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。

错误的意思就是:

意思就是说没有spring-boot-maven-plugin,去本地仓库查看一下,只有两个.lastUpdated文件,说明jar包没有下载成功,再去maven的远程仓库看一下,发现没有spring-boot-maven-plugin。

解决方法:

https://mvnrepository.com网站上重新下载jar包。在搜索框中输入spring-boot-maven-plugin,springloaded即可找到对应的jar包

重新运行,又出现spring-boot-maven-plugin版本号的问题

问题原因:spring-boot-maven-plugin的版本号必须和springloaded的一致,重新下载版本号一致的jar包,重新运行,问题解决,最终pom.xml代码如下:

<!-- springloader 插件 -->
<build>
<plugins>
<plugin>
    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-maven-plugin -->
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>1.2.5.RELEASE</version>

<dependencies>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>springloaded</artifactId>
    <version>1.2.5.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

最后运行成功就是这样的:

[INFO] Downloaded from nexus-aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/vafer/jdependency/0.7/jdependency-0.7.jar (12 kB at 1.0 kB/s)
[INFO] Downloaded from nexus-aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-shade-plugin/2.2/maven-shade-plugin-2.2.jar (100 kB at 8.7 kB/s)
[INFO] Downloaded from nexus-aliyun: http://maven.aliyun.com/nexus/content/groups/public/com/google/guava/guava/11.0.2/guava-11.0.2.jar (1.6 MB at 110 kB/s)
[INFO] Attaching agents: [D:\maven\repository\org\springframework\springloaded\1.2.5.RELEASE\springloaded-1.2.5.RELEASE.jar]
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
	at com.itlaobing.App.main(App.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 1 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.812 s
[INFO] Finished at: 2019-01-04T11:22:21+08:00
[INFO] ------------------------------------------------------------------------

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值