Building Kotlin for JVM with Gradle without using JCenter?

Hello everyone,

I’m trying to build a fairly large Kotlin/Java project with Gradle. Locally, everything is fine, but the build server often has connectivity issues with JCenter:

A problem occurred configuring project ':buildSrc'.
> Could not resolve all files for configuration ':buildSrc:classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21.
     Required by:
         project :buildSrc > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.8.21
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21.
         > Could not parse POM https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.8.21/kotlin-gradle-plugin-1.8.21.pom
            > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.21.
               > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.21.
                  > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-gradle-plugins-bom/1.8.21/kotlin-gradle-plugins-bom-1.8.21.pom'.
                     > Could not HEAD 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugins-bom/1.8.21/kotlin-gradle-plugins-bom-1.8.21.pom'. Received status code 403 from server: Forbidden

Does anybody have a hint for me how I can configure the gradle buildscript (Kotlinscript) to use a different plugin repository that does not rely on JCenter?

Thanks!

Check settings.gradle.kts for the plugin repositories. Also check it in buildSrc or any other gradle subproject.

This seems like a Gradle question, not a Kotlin question. Have a look here: Using Gradle Plugins

JCenter should not be used any more. It has been read only for over 2 years

This is exactly why I’m trying to migrate away from it. But: did you know that “plugins.gradle.org” is just forwarding to JCenter? It seems like a llot of crucial plugins are only hosted there. Which is the motivation for my question how everyone else is dealing with this situation.

Based on Plugins redirecting to jcenter - Plugin Portal - Gradle Forums, if you put Maven Central first it should be fine

jcenter is retired and the SSL certificates are not working, if you really want jcenter binary then you download it offline and add it your gradle or maven using a dummy project

1.) Or you can use and older version Android studio, create a dummy project and download the binaries

2.) Or you can create a proxy application and make SSL request go through a non SSL local address

3.) Or you can use JFrog like artifactory and put the binaries there

4.) And final valid answer remove jcenter in your gradle, upgrade your code to latest version java and libraries

I did the 4th answer, that is only correct way, I did it in real time for a particular airlines corporate.