Java Maven-在当前项目和插件组中找不到前缀“spring-boot”的插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30855864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups
提问by Derek
I am trying to build a springboot project I built with Spring Tools Suite. I get the following error when I execute $mvn spring-boot:run
我正在尝试构建一个我用 Spring Tools Suite 构建的 springboot 项目。执行时出现以下错误$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 插件,但错误没有变化。
采纳答案by Abhijeet
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>
回答by Johnson Abraham
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>
回答by Venkat
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>
回答by Voicu
If you are running the
如果您正在运行
mvn spring-boot:run
from the command line, make sure you are in the directory that contains the pom.xmlfile. Otherwise, you will run into the No plugin found for prefix 'spring-boot' in the current project and in the plugin groupserror.
从命令行,确保您位于包含pom.xml文件的目录中。否则,您将在当前项目和插件组中遇到No plugin found for prefix 'spring-boot'错误。
回答by vfranca9
In my case, my maven variable environment was M2_HOME, so ive changed to MAVEN_HOME and worked.
就我而言,我的 maven 变量环境是 M2_HOME,所以我改为 MAVEN_HOME 并工作。
Tnx.
Tnx。
回答by gxet4n
You should run the $ mvn spring-boot:run
from the folder where your pom.xml
file is located and refer to this answer https://stackoverflow.com/a/33602837/4918021
您应该$ mvn spring-boot:run
从文件所在的pom.xml
文件夹运行,并参考此答案https://stackoverflow.com/a/33602837/4918021
回答by Pushkar Mehta
Make sure pom.xml exist in the directory, when using the mvn spring-boot:run command. No need to add any thing in the pom.xml file.
使用 mvn spring-boot:run 命令时,确保目录中存在 pom.xml。无需在 pom.xml 文件中添加任何内容。
回答by VC2019
In my case I was getting same error and the cause was I had a typo in the command I was using. Was using mvn springboot:run instead of the spring-boot. Using the right command resolved it for me.
在我的情况下,我遇到了同样的错误,原因是我在使用的命令中有一个错字。使用 mvn springboot:run 而不是 spring-boot。使用正确的命令为我解决了它。
回答by Bartosz Popiela
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.
命令代替。
回答by Juan Silupú Maza
Use mvn spring-boot:run
.
No mvn sprint-boot:run
Error Writing.
使用mvn spring-boot:run
. 没有mvn sprint-boot:run
错误写入。