0

I just downloaded and installed Spring Tool Suite 4 for Mac. It has the following version ...

Version: 4.6.2.RELEASE Build Id: 202005250833

I created a brand new Spring Boot project by going to the File menu, selecting "New" and then "Spring Starter Project." I filled out the information on the next screen, and then selected Spring Boot 2.3.1. When I open up the resulting scaffolding, though, there are already compilation errors ...

enter image description here

When I go to my "Run" menu and select "Run As" -> "Spring Boot App," the following error appears

Error: Could not find or load main class com.burrobuie.cardmania.CardmaniaApplication

Is there something else that needs to be done so that there are no compilation errors in my project when it is first created? I feel like this is something that should be the default behavior.

satish
  • 703
  • 5
  • 23
  • 52

1 Answers1

1
  1. In top of STS you see File Edit Navigate Search Project
  2. Click on Project -> clean -> select your project -> check Build automatically
  3. Click on Project -> clean -> select your project -> clean
  4. Look for the pom file of your project
  5. Right click on pom file -> maven -> update project.
  6. Right click on pom file -> run as -> maven build -> goals: enter'clean install' -> run
  7. In the console you should see build success.

your compilation errors will be all gone. Not all these steps are required to do every time it only when you see compilation error performing one or all the steps will resolve the issue.

Guru Cse
  • 2,805
  • 2
  • 18
  • 15
  • That helped me troubleshoot the issue further. I get the error, "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project cardmania: Fatal error compiling: invalid target release: 11 -> [Help 1]". Somehow, I need to figure out how to configure STS to recognize my Java 11 installation. – satish Jun 17 '20 at 20:44
  • In STS top windows -> prferences -> java -> installed JREs -> point to ur jdk folder eg: C:\Program Files\Java\jdk-13.0.2 – Guru Cse Jun 17 '20 at 21:27