Java Spring Boot API Gold medal metrics Maven issue

I’m having an issue with:
https://www.codecademy.com/paths/create-rest-apis-with-spring-and-java/tracks/spring-apis-data-with-jpa/modules/spring-gold-medal-metrics/informationals/spring-gold-medal-metrics

I’m unable to execute the mvnw spring-boot:run command in the intellij terminal. The error I get is:

mvnw : The term ‘mvnw’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • mvnw spring-boot:run
  •   + CategoryInfo          : ObjectNotFound: (mvnw:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

I’ve reloaded the project in the IDE and it changes nothing. Any ideas on how to fix this?

1 Like

Are you on Windows? Use the ./mvnw spring-boot:run version of the command. The lesson says to do it without the ./ for windows, but you need it if you are using powershell (the default in intelliJ). Maybe without the ./ is for command prompt?

Funnily enough, I was able to get it to run by using backslash rather than forward slash.
.\mvnw spring-boot:run
I think restarting my PC might have also had something to do with it. Thanks for the help @davejandrea

1 Like

Hello,
I have Java version 17.0.1 and I am getting the following message when trying to use the ./mvnw spring-boot:run command:

permission denied: ./mvnw

is there a way to update the spring-boot to work with the java 17 version?

same…I just ran mvn spring boot run but it compiles to a lot of errors syntax mostly from the starter project.

None of these work? anyone have any other suggestions?

Related issue, I think.

I encountered a compilation error just at the beginning.
Following this suggestion: “If you run into issues building, double-check that JDK 11 is installed and that your JAVA_HOME environment variable points to the JDK 11 installation folder”, I checked and found that I have version 17 installed:

and that my JAVA_HOME is also pointing to that installation:
image

My question is what can I do to change it only for the Gold Medal Metrics project, not entirely? Is there a way to avoid uninstallation of java 17 and its replacement with java 11 for the whole system?

Thanks in advance!

Would it be ok if I just changed this part in my pom.xml: <java.version>11</java.version> to 17 or 17.0.4 - the actual version??

OR

Is the way presented below a better solution?

" Here are the steps:

  • Go to Preference(or Settings) in IntelliJ ( or Shortcut on Mac ⌘ + ,)
  • Build, Execution, Deployment > Build Tools > Maven > Importing - select the “JDK for Importer” dropdown then select your preferred java version, Click Apply
  • Build, Execution, Deployment > Maven > Runner - select the “JRE” dropdown then select your preferred java version, Click Apply
  • Click OK "

(taken from StackOverflow.org, thanks to papigee,
How to change Java version for Maven in IntelliJ? - Stack Overflow)

I would be very thankful for help and broader explanation which and why should I choose?
However, there still might be some, even better, solution… hmm…

Best!

No answers came so I tried to implement the second clue but encountered another problem.
Even though I’ve installed java 11 on my computer, I can’t find and select it in IntelliJ Settings for Maven importing:

Please, help!