sab
sab

Reputation: 5022

Gradle doesn't find plugins: org.jetbrains.kotlin.jvm and kotlin2js

I'm a beginner in gradle, using version 4.8.

Whatever I do , the plugins are never found. I get this error message:

Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.3.20'] was not found in any of the following sources:

No matter how many repositories I add, it seems it is only looking in "Gradle Central Plugin Repository"

My gradle.build file:

buildscript {

    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
        classpath "org.jetbrains.kotlin.jvm:kotlin-gradle-plugin:1.3.20"

    }

}

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.3.20'
    id 'kotlin2js' version '1.3.20'
}

Can you help me?

Upvotes: 2

Views: 12554

Answers (4)

HC Devloper
HC Devloper

Reputation: 1

Go to your project and then to the Gradle script. In Gradle, Go to Setting.Gradle and change the Fist Bitray Url to https://plugins.gradle.org/m2/.

Upvotes: 0

nss201
nss201

Reputation: 136

I had similar problem because i forgot about proxy settings like systemProp.https.proxyHost and systemProp.http.proxyHost and etc. that was set in ~/.gradle/gradle.properties.

I fixed configuration and plugin was successfully dowlnloaded

Check gradle.properties and try to add correct proxy settings if you behind firewall or escape this settings if you not.

Upvotes: 3

Erik Pragt
Erik Pragt

Reputation: 14627

Try the following gradle.build configuration:

buildscript {

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
    }

}

plugins {
    id 'java'
}

apply plugin: 'kotlin2js'

repositories {
    mavenCentral()
}

When you include the plugin by id, it seems Gradle wants to retrieve the plugin from the Gradle plugin portal, but the Kotlin plugin is not there, it's part of the buildscript dependency. Using it with the apply plugin works. You can also find a slightly different working example here.

Upvotes: 1

Martin Zeitler
Martin Zeitler

Reputation: 76679

you need to add repository mavenCentral() to the buildscript dependencies.

for example: kotlin-gradle-plugin:1.3.20. also the documentation hints for that.

Upvotes: 0

Related Questions