[英]Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups
I am trying to build a springboot project I built with Spring Tools Suite.我正在尝试构建一个我用 Spring Tools Suite 构建的 springboot 项目。 I get the following error when I execute
$mvn spring-boot:run
执行
$mvn spring-boot:run
时出现以下错误
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 14.0 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 21.8 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.032 s
[INFO] Finished at: 2015-06-15T17:46:50-04:00
[INFO] Final Memory: 11M/123M
[INFO] ------------------------------------------------------------------------
[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 (/Users/admin/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException`
Heres my pom.xml plugin这是我的 pom.xml 插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument>--spring.profiles.active=dev</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
I tried the jhipster plugin above and no change in the error.我尝试了上面的 jhipster 插件,但错误没有变化。
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.从命令行,确保您位于包含pom.xml文件的目录中。 Otherwise, you will run into the No plugin found for prefix 'spring-boot' in the current project and in the plugin groups error.
否则,您将在当前项目和插件组中遇到No plugin found for prefix 'spring-boot'错误。
If you are using Spring Boot for application, forgetting to add如果您使用 Spring Boot 作为应用程序,忘记添加
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
can cause this issue, as well as missing these lines可能会导致此问题,以及缺少这些行
<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>
If you don't want to use如果您不想使用
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>(...)</version>
</parent>
as a parent POM, you may use the作为父 POM,您可以使用
mvn org.springframework.boot:spring-boot-maven-plugin:run
command instead.命令代替。
Typos are a possible reason for this error.错别字是此错误的可能原因。
Be sure to check you wrote spring-boot
and not eg springboot
or sprint-boot
or springbok
or whatever.请务必检查您是否编写了
spring-boot
而不是例如springboot
或sprint-boot
或springbok
或其他任何东西。
Also check the ordering : use spring-boot:run
and not run:spring-boot
.还要检查排序:使用
spring-boot:run
而不是run:spring-boot
。
You might want to add the following to your pom and try compiling您可能希望将以下内容添加到您的 pom 并尝试编译
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
您应该从pom.xml
文件所在的文件夹运行$ mvn spring-boot:run
并参考此答案https://stackoverflow.com/a/33602837/4918021
Use mvn spring-boot:run
.使用
mvn spring-boot:run
。 No mvn sprint-boot:run
Error Writing.没有
mvn sprint-boot:run
写入错误。
Adding spring-boot-maven-plugin in the build resolved it in my case在我的情况下,在构建中添加 spring-boot-maven-plugin 解决了它
<build>
<finalName>mysample-web</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Make sure pom.xml exist in the directory, when using the mvn spring-boot:run command.使用 mvn spring-boot:run 命令时,确保目录中存在 pom.xml。 No need to add any thing in the pom.xml file.
无需在 pom.xml 文件中添加任何内容。
Instead of using the full plugin name (with groupId) like described in Bartosz's answer , you could add而不是像Bartosz 的回答中描述的那样使用完整的插件名称(带有 groupId),您可以添加
<pluginGroups>
<pluginGroup>org.springframework.boot</pluginGroup>
</pluginGroups>
to your .m2/settings.xml.到您的 .m2/settings.xml。
In my case I got this error after updating my spring boot in pom.xml and running it in Eclipse.就我而言,在 pom.xml 中更新 spring boot 并在 Eclipse 中运行它后,我收到了此错误。
The source of the error is that the run configuration was set to offline, thus it couldn't download plugins on run.错误的来源是运行配置设置为离线,因此无法在运行时下载插件。
就我而言,我的 maven 变量环境是 M2_HOME,所以我已更改为 MAVEN_HOME 并开始工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.