英文:
Spring Boot Dashboard won't show me App on VSCode
问题
以下是翻译好的内容:
我正在尝试在 Visual Studio Code 中启动一个 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
,但失败了,以下是输出:
PS C:\Projects\PortalTimbrado> mvn spring-boot:run
[INFO] Scanning for projects...
从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/apache/maven/plugins/maven-metadata.xml
从 central 下载: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/codehaus/mojo/maven-metadata.xml
从 central 下载: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/codehaus/mojo/maven-metadata.xml
从 central 下载: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/apache/maven/plugins/maven-metadata.xml
从 central 下载: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
已从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/apache/maven/plugins/maven-metadata.xml (2.5 kB,1.9 kB/s)
已从 central 下载: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB,9.5 kB/s)
已从 redhat-ga 下载: https://maven.repository.redhat.com/ga/org/codehaus/mojo/maven-metadata.xml (537 B,368 B/s)
已从 central 下载: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB,14 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] 构建失败
[INFO] ------------------------------------------------------------------------
[INFO] 总时间:2.524 s
[INFO] 完成时间:2020-09-10T10:41:04-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] 在当前项目中和插件组 [org.apache.maven.plugins, org.codehaus.mojo] 中找不到前缀为 'spring-boot' 的插件,这些插件可从仓库 [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] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。
[ERROR] 使用 -X 开关重新运行 Maven,以启用完整的调试日志记录。
[ERROR]
[ERROR] 有关错误和可能的解决方法的更多信息,请阅读以下文章:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
请帮帮我!
英文:
I am trying to launch a maven project in visual studio code, I run the mvn clean install command to generate the war and everything is correct, but in the spring-boot dashboard tab the application does not appear to be able to start it.
This is my maven and java version:
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"
I have tried with the command mvn spring-boot:run but failed, this is the output:
[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!
</details>
# 答案1
**得分**: 1
你确定在 pom.xml 中包含了 Maven 构建插件吗?
```xml
<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 命令。
英文:
Are you sure have maven build plugin in pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Also check your parent in 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>
Then retry mvn spring-boot:run command
答案2
得分: 1
Eskibear 在 2018 年 10 月 15 日发表了评论:
我下载了你的项目并尝试了一下,但我无法复现这个问题。一开始它在“导入项目”时卡住了,因为语言服务器正在下载依赖项。大约不到 1 分钟后,“demo” 项目就出现在资源管理器中了。
你可以尝试以下步骤,但我不确定是否能帮助解决你的问题:
- 关闭所有的 VSCode 窗口。
- 打开 ~/.vscode/extensions 文件夹,并删除文件夹名称以 "redhat.java"、"vscjava.vscode-spring-boot-dashboard"、"vscjava.vscode-java-debug"、"pivotal.vscode-spring-boot" 为前缀的文件夹。
- 打开 VSCode,从市场安装 Spring Boot 仪表板扩展。
- 现在尝试再次打开项目,看看是否正常工作。
英文:
source: https://github.com/Microsoft/vscode-spring-boot-dashboard/issues/44
Eskibear commented on 15 Oct 2018
I downloaded your project and had a try, and I just could not reproduce the issue. It first stuck on "importing projects" as expected because the language server was downloading the dependencies. And after <1 min, the project "demo" appeared in the explorer.
You may have a try of the following steps, but I'm not sure whether it can help you out or not.
Close all your VSCode windows.
Open ~/.vscode/extensions folder, and remove folders with prefix like "redhat.java", "vscjava.vscode-spring-boot-dashboard", "vscjava.vscode-java-debug", "pivotal.vscode-spring-boot".
Open VSCode, install the spring boot dashboard extension from the marketplace.
Now try opening the project again, see if it works.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论