Home > Back-end >  Having java versioning issue with gradle in Spring project in IntelliJ
Having java versioning issue with gradle in Spring project in IntelliJ

Time:01-05

I created a project from start.spring.io. No matter whether I choose Java 11 or Java 17 there, I get this error when I open this spring project in IntelliJ.

Error:

Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.1 was found.
Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11.

Note: I have installed Java 11 on my local machine.

Why importing Java/Gradle project is so much errorneous in IntelliJ?

CodePudding user response:

Spring Boot 3 requires Java 17 as minimum version. So just install Java 17 and update java runtime path in IntelliJ.

CodePudding user response:

Spring Boot 3 requires Java 17 as a minimum Java version, so you need to install this on your machine. (If you need to use several Java versions in parallel on your machine, this can be done quite nicely with SDKMan (https://sdkman.io/).

In IntelliJ, you need to add the new Java runtime to the known Java runtimes (File > Project Settings > SDKs) and the use it for your project (File > Project Settings > Project > SDK).

  • Related