kotlin-compiler-embeddable:1.3.61 because no repositories

Viewed 3029

this keeps me anonying for a day i'm foolish . anyone helps me ?

i got this error message below

Cannot resolve external dependency org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.61 because no repositories are defined.


that's my build.gradle below

plugins {
    id 'idea'
    id "org.jetbrains.kotlin.jvm"  version "1.3.61"
    id "org.jetbrains.kotlin.kapt" version "1.3.61" apply false
    id "org.jetbrains.kotlin.plugin.spring" version "1.3.61" apply false
    id "org.jetbrains.kotlin.plugin.jpa"  version "1.3.61" apply false
    id "org.springframework.boot" version "2.1.6.RELEASE" apply false
    id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
    id "com.palantir.docker" version "0.22.1" apply false
}

subprojects {
    group = "bawoori"
    version = "1.0"
    sourceCompatibility = 1.8

    apply plugin: "kotlin"
    apply plugin: "io.spring.dependency-management"

    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    }

    compileKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = '1.8'
        }
    }

    compileTestKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = '1.8'
        }
    }
}
2 Answers

you need add allprojects:

plugins {
    id 'idea'
    id "org.jetbrains.kotlin.jvm"  version "1.3.61"
    id "org.jetbrains.kotlin.kapt" version "1.3.61" apply false
    id "org.jetbrains.kotlin.plugin.spring" version "1.3.61" apply false
    id "org.jetbrains.kotlin.plugin.jpa"  version "1.3.61" apply false
    id "org.springframework.boot" version "2.1.6.RELEASE" apply false
    id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
    id "com.palantir.docker" version "0.22.1" apply false
}

allprojects {
    group = "bawoori"
    version = "1.0"
    sourceCompatibility = "1.8"

    repositories {
        mavenCentral()
        jcenter()
    }

    compileKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = sourceCompatibility
        }
    }

    compileTestKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = sourceCompatibility
        }
    }
}

subprojects {
    apply plugin: "kotlin"
    apply plugin: "io.spring.dependency-management"

    repositories {
        mavenCentral()
        jcenter()
    }
}

You need to resolve your dependency through jcenter() so add

repositories {
    jcenter()
}

to your build.gradle file.

repositories {
          jcenter()
     }
    
    plugins {
        id 'idea'
        id "org.jetbrains.kotlin.jvm"  version "1.3.61"
        id "org.jetbrains.kotlin.kapt" version "1.3.61" apply false
        id "org.jetbrains.kotlin.plugin.spring" version "1.3.61" apply false
        id "org.jetbrains.kotlin.plugin.jpa"  version "1.3.61" apply false
        id "org.springframework.boot" version "2.1.6.RELEASE" apply false
        id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
        id "com.palantir.docker" version "0.22.1" apply false
    }
    
    subprojects {
        group = "bawoori"
        version = "1.0"
        sourceCompatibility = 1.8
    
        apply plugin: "kotlin"
        apply plugin: "io.spring.dependency-management"
    
        repositories {
            mavenCentral()
            jcenter()
        }
    
        dependencies {
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
        }
    
        compileKotlin {
            kotlinOptions {
                freeCompilerArgs = ['-Xjsr305=strict']
                jvmTarget = '1.8'
            }
        }
    
        compileTestKotlin {
            kotlinOptions {
                freeCompilerArgs = ['-Xjsr305=strict']
                jvmTarget = '1.8'
            }
        }
    }
Related