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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_41373740/article/details/85764091

使用 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] ------------------------------------------------------------------------

猜你喜欢

转载自blog.csdn.net/qq_41373740/article/details/85764091