error: “A project with the name X already exists” (Java/Maven/VScode)

huangapple 未分类评论43阅读模式
英文:

error: "A project with the name X already exists" (Java/Maven/VScode)

问题

我正在按照这个VScode教程的指示进行操作:https://code.visualstudio.com/docs/java/java-webapp。它基于Spring Boot的这个教程:https://github.com/spring-guides/gs-spring-boot

我现在在构建项目的步骤。我打开complete/bin/src中的Application.java文件,然后按下F5进行构建。但每次都会遇到以下错误:

"已经存在一个名为spring-boot的项目。
提供的分阶段操作由于异常而失败。
重复的根元素spring-boot"

在VScode资源管理器的'Maven'选项卡中,确实显示了两个名为"spring-boot"的项目。我认为这可能是因为'initial'文件夹中也有一个Maven项目。我尝试删除了这个'initial'文件夹,但错误仍然存在。

这是我第一次构建Web应用,也是第一次使用Maven、VSCode和Spring Boot。而且,我的问题可能与Spring Boot/Maven/VSCode的组合有关。
以下是显示了我在VSCode项目中的所有讨论元素的屏幕截图:https://i.stack.imgur.com/d1zY3.jpg

英文:

I'm following the instructions in this VScode tutorial: https://code.visualstudio.com/docs/java/java-webapp. It is based on this tutorial by Spring Boot: https://github.com/spring-guides/gs-spring-boot

I'm at the step of building the project. I open the Application.java file in complete/bin/src and press F5 to build. I get this error every time:

"A project with the name spring-boot already exists.
The supplied phased action failed with an exception.
Duplicate root element spring-boot"

The 'Maven' tab of VScode's explorer does show two projects titled "spring-boot". I think this is because there is also a maven project in the "initial" folder. I tried deleting this "initial" folder but the error persisted.

This is my first time building a web app, and first time using Maven, VSCode, and Spring Boot. Also, my question might be specific to the combo of Spring Boot/Maven/VScode.
Here is a screenshot of my the VScode project, showing all the elements discussed here: https://i.stack.imgur.com/d1zY3.jpg

答案1

得分: 0

以下是我解决相同问题的方法。

该存储库包含两个项目:initial(初始)和complete(完成)。要按照教程进行操作:

  • 删除“complete”项目;你应该删除主机上存储它的“complete”文件夹,并重新启动VS Code以查看更改。

  • 如果像我遇到的情况一样,在VS Code中无法直接删除它,你也可以尝试以同样的方式删除“initial”文件夹。这对我起作用了。

英文:

Here's how I solved the same issue.

The repository contains two projects: initial and complete. To follow the tutorial:

  • Delete the "complete" project; you should delete the "complete" folder where you stored it on your host and restart VS-code to see the changes.

  • In case, like happened to me, you are unable to delete it in VS code directly, you can also try deleting the "initial" folder that way. It worked for me.

huangapple
  • 本文由 发表于 2020年7月27日 00:55:30
  • 转载请务必保留本文链接:https://java.coder-hub.com/63103107.html
匿名

发表评论

匿名网友

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

确定