ERROR:当前项目中找不到以“spring”为前缀的插件。

huangapple go评论175阅读模式
英文:

ERROR No plugin found for prefix 'spring' in the current project

问题

I just created a Spring Boot project and that runs fine in the Intellij IDE. However, when I try to run the project from the terminal, I receive the message,

我刚刚创建了一个Spring Boot项目,在Intellij IDE中运行正常。但是,当我尝试从终端运行项目时,我收到以下消息:

  1. $ mvn spring:boot run
  2. [INFO] Scanning for projects...
  3. Downloading from spring-milestones: https://repo.spring.io/milestone/org/codehaus/mojo/maven-metadata.xml
  4. Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/plugins/maven-metadata.xml
  5. Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
  6. Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/plugins/maven-metadata.xml
  7. Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
  8. Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/codehaus/mojo/maven-metadata.xml
  9. Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 6.3 kB/s)
  10. Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 11 kB/s)
  11. [INFO] ------------------------------------------------------------------------
  12. [INFO] BUILD FAILURE
  13. [INFO] ------------------------------------------------------------------------
  14. [INFO] Total time: 3.715 s
  15. [INFO] Finished at: 2020-01-06T18:03:47+06:00
  16. [INFO] ------------------------------------------------------------------------
  17. [ERROR] No plugin found for prefix 'spring' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/Chaklader/.m2/repository), spring-milestones (https://repo.spring.io/milestone), spring-snapshots (https://repo.spring.io/snapshot), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
  18. [ERROR]
  19. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  20. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  21. [ERROR]
  22. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  23. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

I use the command $ mvn spring:boot run to run the project from the terminal.

我使用命令$ mvn spring:boot run从终端运行项目。

My pom.xml file is provided below,

以下是我的pom.xml文件:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-parent</artifactId>
  8. <version>2.2.3.BUILD-SNAPSHOT</version>
  9. <relativePath/> <!-- lookup parent from repository -->
  10. </parent>
  11. <groupId>com.example</groupId>
  12. <artifactId>demo</artifactId>
  13. <version>0.0.1-SNAPSHOT</version>
  14. <name>demo</name>
  15. <description>Demo project for Spring Boot</description>
  16. <properties>
  17. <java.version>1.8</java.version>
  18. </properties>
  19. <dependencies>
  20. <!--
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-starter-data-jpa</artifactId>
  24. </dependency>
  25. -->
  26. <dependency>
  27. <groupId>org.springframework.boot</groupId>
  28. <artifactId>spring-boot-starter-web</artifactId>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.springframework.boot</groupId>
  32. <artifactId>spring-boot-starter-test</artifactId>
  33. <scope>test</scope>
  34. <exclusions>
  35. <exclusion>
  36. <groupId>org.junit.vintage</groupId>
  37. <artifactId>junit-vintage-engine</artifactId>
  38. </exclusion>
  39. </exclusions>
  40. </dependency>
  41. </dependencies>
  42. <build>
  43. <plugins>
  44. <plugin>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-maven-plugin</artifactId>
  47. </plugin>
  48. </plugins>
  49. </build>
  50. <repositories>
  51. <repository>
  52. <id>spring-milestones</id>
  53. <name>Spring Milestones</name>
  54. <url>https://repo.spring.io/milestone</url>
  55. </repository>
  56. <repository>
  57. <id>spring-snapshots</id>
  58. <name>Spring Snapshots</name>
  59. <url>https://repo.spring.io/snapshot</url>
  60. <snapshots>
  61. <enabled>true</enabled>
  62. </snapshots>
  63. </repository>
  64. </repositories>
  65. <pluginRepositories>
  66. <pluginRepository>
  67. <id>spring-milestones</id>
  68. <name>Spring Milestones</name>
  69. <url>https://repo.spring.io/milestone</url>
  70. </pluginRepository>
  71. <pluginRepository>
  72. <id>spring-snapshots</id>
  73. <name>Spring Snapshots</name>
  74. <url>https://repo.spring.io/snapshot</url>
  75. <snapshots>
  76. <enabled>true</enabled>
  77. </snapshots>
  78. </pluginRepository>
  79. </pluginRepositories>
  80. </project>

I find there are several questions with the same query, but, I think my project is correct as it's run fine in the IDE, so, why would it break in the OS X terminal?

我发现有几个类似的问题,但是我认为我的项目是正确的,因为在IDE中它能正常运行,那么为什么在OS X终端中会出问题呢?

英文:

I just created a Spring Boot project and that runs fine in the Intellij IDE. However, when I try to run the project from the terminal, I receive the message,

  1. $ mvn spring:boot run
  2. [INFO] Scanning for projects...
  3. Downloading from spring-milestones: https://repo.spring.io/milestone/org/codehaus/mojo/maven-metadata.xml
  4. Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/plugins/maven-metadata.xml
  5. Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
  6. Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/plugins/maven-metadata.xml
  7. Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
  8. Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/codehaus/mojo/maven-metadata.xml
  9. Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 6.3 kB/s)
  10. Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 11 kB/s)
  11. [INFO] ------------------------------------------------------------------------
  12. [INFO] BUILD FAILURE
  13. [INFO] ------------------------------------------------------------------------
  14. [INFO] Total time: 3.715 s
  15. [INFO] Finished at: 2020-01-06T18:03:47+06:00
  16. [INFO] ------------------------------------------------------------------------
  17. [ERROR] No plugin found for prefix &#39;spring&#39; in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/Chaklader/.m2/repository), spring-milestones (https://repo.spring.io/milestone), spring-snapshots (https://repo.spring.io/snapshot), central (https://repo.maven.apache.org/maven2)] -&gt; [Help 1]
  18. [ERROR]
  19. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  20. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  21. [ERROR]
  22. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  23. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

I use the command $ mvn spring:boot run to run the project from the terminal.

My pom.xml file is provided below,

  1. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  2. &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  3. xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  4. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  5. &lt;parent&gt;
  6. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  7. &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
  8. &lt;version&gt;2.2.3.BUILD-SNAPSHOT&lt;/version&gt;
  9. &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  10. &lt;/parent&gt;
  11. &lt;groupId&gt;com.example&lt;/groupId&gt;
  12. &lt;artifactId&gt;demo&lt;/artifactId&gt;
  13. &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  14. &lt;name&gt;demo&lt;/name&gt;
  15. &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  16. &lt;properties&gt;
  17. &lt;java.version&gt;1.8&lt;/java.version&gt;
  18. &lt;/properties&gt;
  19. &lt;dependencies&gt;
  20. &lt;!-- &lt;dependency&gt;--&gt;
  21. &lt;!-- &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;--&gt;
  22. &lt;!-- &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;--&gt;
  23. &lt;!-- &lt;/dependency&gt;--&gt;
  24. &lt;dependency&gt;
  25. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  26. &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  27. &lt;/dependency&gt;
  28. &lt;dependency&gt;
  29. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  30. &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
  31. &lt;scope&gt;test&lt;/scope&gt;
  32. &lt;exclusions&gt;
  33. &lt;exclusion&gt;
  34. &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
  35. &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
  36. &lt;/exclusion&gt;
  37. &lt;/exclusions&gt;
  38. &lt;/dependency&gt;
  39. &lt;/dependencies&gt;
  40. &lt;build&gt;
  41. &lt;plugins&gt;
  42. &lt;plugin&gt;
  43. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  44. &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
  45. &lt;/plugin&gt;
  46. &lt;/plugins&gt;
  47. &lt;/build&gt;
  48. &lt;repositories&gt;
  49. &lt;repository&gt;
  50. &lt;id&gt;spring-milestones&lt;/id&gt;
  51. &lt;name&gt;Spring Milestones&lt;/name&gt;
  52. &lt;url&gt;https://repo.spring.io/milestone&lt;/url&gt;
  53. &lt;/repository&gt;
  54. &lt;repository&gt;
  55. &lt;id&gt;spring-snapshots&lt;/id&gt;
  56. &lt;name&gt;Spring Snapshots&lt;/name&gt;
  57. &lt;url&gt;https://repo.spring.io/snapshot&lt;/url&gt;
  58. &lt;snapshots&gt;
  59. &lt;enabled&gt;true&lt;/enabled&gt;
  60. &lt;/snapshots&gt;
  61. &lt;/repository&gt;
  62. &lt;/repositories&gt;
  63. &lt;pluginRepositories&gt;
  64. &lt;pluginRepository&gt;
  65. &lt;id&gt;spring-milestones&lt;/id&gt;
  66. &lt;name&gt;Spring Milestones&lt;/name&gt;
  67. &lt;url&gt;https://repo.spring.io/milestone&lt;/url&gt;
  68. &lt;/pluginRepository&gt;
  69. &lt;pluginRepository&gt;
  70. &lt;id&gt;spring-snapshots&lt;/id&gt;
  71. &lt;name&gt;Spring Snapshots&lt;/name&gt;
  72. &lt;url&gt;https://repo.spring.io/snapshot&lt;/url&gt;
  73. &lt;snapshots&gt;
  74. &lt;enabled&gt;true&lt;/enabled&gt;
  75. &lt;/snapshots&gt;
  76. &lt;/pluginRepository&gt;
  77. &lt;/pluginRepositories&gt;
  78. &lt;/project&gt;

I find there are several questions with the same query, but, I think my project is correct as it's run fine in the IDE, so, why would it break in the OS X terminal?

答案1

得分: 3

Use command: mvn spring-boot:run

英文:

Use command: mvn spring-boot:run

huangapple
  • 本文由 发表于 2020年1月6日 20:12:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/59611901.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定