Can`t build project in Intelij IDEA with Sprong Boot

Cannot build Spring Boot project from Spring Initializr with Gradle. Error:

problem occurred configuring root project 'currency_2'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-buildpack-platform:2.6.3.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.3 > org.springframework.boot:spring-boot-gradle-plugin:2.6.3
      > Could not resolve org.springframework.boot:spring-boot-buildpack-platform:2.6.3.
         > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-buildpack-platform/2.6.3/spring-boot-buildpack-platform-2.6.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/springframework/boot/spring-boot-buildpack-platform/2.6.3/spring-boot-buildpack-platform-2.6.3.pom'. Received status code 403 from server: Forbidden

But in build.gradle I have

repositories {
    mavenCentral()
}

Gradle was downloaded and installed from the official website.

PS C:\Users\Pasya> gradle -v

------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------

Build time:   2023-11-29 14:08:57 UTC
Revision:     28aca86a7180baa17117e0e5ba01d8ea9feca598
Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21.0.1 (Eclipse Adoptium 21.0.1+12-LTS)
OS:           Windows 11 10.0 amd64
PS C:\Users\Pasya>

PS C:\Users\Pasya> java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)
PS C:\Users\Pasya>

The PATH variable was set

2024-01-05 233143
Please help, I dont understand what I`m dooing wrong.

But in build.gradle I have

repositories {
   mavenCentral()
}

That’s irrelevant.
It does not complain about a production dependency, but a dependency of a plugin.
For that the repositories in pluginManagement { repositories { ... } } in the settings script are used.
If none are given by default the Gradle Plugin Portal is used, which redirects to JCenter for things it does not have, which forwards to Maven Central for things it does not have.
But in your case JCenter answered with “403 Forbidden”.
Most probably just one of the regular JCenter quirks.
Right now it works, so just try again, eventually using --refresh-dependencies.

To reduce the likeliness of this happening in the future, you could add mavenCentral() and after that gradlePluginPortal() to the plugin repositories, this way JCenter would only be contacted for things really only available there which should be close to none by now hopefully.

Gradle was downloaded and installed from the official website.

This is pretty irrelevant. Each and every Gradle build should contain the 4 Gradle wrapper files and those should be used to execute a build. They define the exact Gradle version a build is designed for and working with and care about provisioning and using exactly that version. You pracatically never need any Gradle version installed manually, just a Java verison that is compatible with the Gradle version of the build you try to execute: Compatibility Matrix

1 Like