简体   繁体   中英

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

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://imgur.com/a/qPkCTNz

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM