我正在尝试在 Visual Studio 代码中启动 Maven 项目,我运行 mvn clean install 命令来生成 war ,一切都正确,但在 spring-boot 仪表板选项卡中,应用程序似乎无法启动它。
这是我的 Maven 和 java 版本:
PS C:\Projects\PortalTimbrado> mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T10:06:16-05:00)
Maven home: C:\Maven\bin\..
Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_251\jre
Default locale: es_MX, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
我尝试使用命令mvn spring-boot:run但失败了,这是输出:
[INFO] Scanning for projects...
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/codehaus/mojo/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloaded from redhat-ga: https://maven.repository.redhat.com/ga/org/apache/maven/plugins/maven-metadata.xml (2.5 kB at 1.9 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 9.5 kB/s)
Downloaded from redhat-ga: https://maven.repository.redhat.com/ga/org/codehaus/mojo/maven-metadata.xml (537 B at 368 B/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 14 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.524 s
[INFO] Finished at: 2020-09-10T10:41:04-05:00
[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 (C:\Users\dlopezd\.m2\repository), redhat-ga (https://maven.repository.redhat.com/ga/), 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```
Please help me!
最佳答案
您确定 pom.xml 中有 Maven 构建插件吗
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
还要检查 pom.xml 中的父级
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
然后重试mvn spring-boot:run命令
关于java - Spring Boot 仪表板不会在 VSCode 上显示应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63832545/