错误当前项目中找不到前缀“spring”的插件
我刚刚创建了一个Spring启动项目,它在Intellij IDE中运行良好。但是,当我尝试从终端运行项目时,我收到消息错误当前项目中找不到前缀“spring”的插件,spring,spring-boot,maven,intellij-idea,terminal,Spring,Spring Boot,Maven,Intellij Idea,Terminal,我刚刚创建了一个Spring启动项目,它在Intellij IDE中运行良好。但是,当我尝试从终端运行项目时,我收到消息 $ mvn spring:boot run [INFO] Scanning for projects... Downloading from spring-milestones: https://repo.spring.io/milestone/org/codehaus/mojo/maven-metadata.xml Downloading from spring-snap
$ mvn spring:boot run
[INFO] Scanning for projects...
Downloading from spring-milestones: https://repo.spring.io/milestone/org/codehaus/mojo/maven-metadata.xml
Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading from spring-milestones: https://repo.spring.io/milestone/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading from spring-snapshots: https://repo.spring.io/snapshot/org/codehaus/mojo/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 6.3 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 11 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.715 s
[INFO] Finished at: 2020-01-06T18:03:47+06:00
[INFO] ------------------------------------------------------------------------
[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]
[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
我使用命令$mvn spring:boot run从终端运行项目
下面提供了我的pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.3.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
我发现同一个查询有几个问题,但是,我认为我的项目是正确的,因为它在IDE中运行良好,所以,为什么它会在OSX终端中中断 Use command:mvn spring boot:run我知道这个问题本身很简单,但我花了很多时间没有解决这个问题。如果您使用了错误的命令,请使用mvn spring boot:run@YogendraR谢谢。这个命令也可以使用:$mvnorg.springframework.boot:springbootmaven plugin:run你能把它们写在一个答案中,这样对其他人可能会有帮助吗?我不是一个完全的初学者,我也在浪费时间。如果你不想,我也可以写这个命令作为答案。这个命令也很好:$mvn org.springframework.boot:spring boot maven plugin:run