kotlin + gradle + intellij-未定义存储库 [英] kotlin + gradle+ intellij - no repositories are defined

查看:152
本文介绍了kotlin + gradle + intellij-未定义存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?我只是从前同事那里得到项目源代码和dockefile,而没有工作解释,但是现在我遇到了时间限制的麻烦. 请拜托.

anyone can help me out please? i got just project source code and dockefile from ex-colleague without explanation of work but i got in trouble now with time limitation. please please please.

我在下面收到此错误消息

i got this error message below

Could not determine the dependencies of task ':compileKotlin'.
Could not resolve all files for configuration ':kotlinCompilerClasspath'.
Cannot resolve external dependency org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.41 
because no repositories are defined.


那是我的build.gradle在下面


that's my build.gradle below

plugins {
    id 'idea'
    id "org.jetbrains.kotlin.jvm"  version "1.3.41"
    id "org.jetbrains.kotlin.kapt" version "1.3.41" apply false
    id "org.jetbrains.kotlin.plugin.spring" version "1.3.41" apply false
    id "org.jetbrains.kotlin.plugin.jpa"  version "1.3.41" 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"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.41"
    }
    compileKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = '1.8'
        }
    }
    compileTestKotlin {
        kotlinOptions {
            freeCompilerArgs = ['-Xjsr305=strict']
            jvmTarget = '1.8'
        }
    }
}

推荐答案

您需要为构建脚本的root Gradle项目定义存储库:

You need to define repository for root Gradle project for the build script:

buildscript {
    repositories {
        mavenCentral()
    }

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

plugins {
    id "org.jetbrains.kotlin.<...>" version "1.3.70"
}

repositories {
    // this repo should be available in every subproject that uses kotlin
    mavenCentral() // or jcentrer
}

有关更多信息,请参阅Kotlin文档中的使用Gradle 部分.

See Using Gradle section in Kotlin documentation for more information.

这篇关于kotlin + gradle + intellij-未定义存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆