Gradle 无法解析 'kotlin' 插件。我是否缺少正确的 Maven 存储库?

Gradle can't resolve 'kotlin' plugin. Am I missing the correct maven repository?

gradle tasks 没有告诉我找不到插件 'kotlin'。我的 build.gradle 文件开头为:

buildscript {
  ext.kotlin_version = '1.3.11'
  repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url "https://dl.bintray.com/kotlin/kotlin-dev/" }
    maven { url "http://central.maven.org/maven2/" }
  }
  dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

plugins {
  id 'kotlin'
  id 'application'
}

WRT maven 存储库,我显然只是想冗余地添加我能找到的所有厨房水槽。我试过 none,并注释掉了一些。我错过了哪一个? 来自日志:

12:55:04.419 [DEBUG] [org.gradle.launcher.daemon.server.exec.ReturnResult] Daemon is dispatching the build result: Failure[value=org.gradle.initialization.Repor
tedException: org.gradle.internal.exceptions.LocationAwareException: Build file '/home/_/workspace/_/build.gradle' line: 18
Plugin [id: 'kotlin'] was not found in any of the following sources:

- Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/5.0/userguide/standard_plugins.html for available core plugins)
- Plugin Repositories (plugin dependency must include a version number for this source)]

我也试过 1.3.10 版本,因为它与 gradle 版本信息中列出的相匹配:

------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------

Build time:   2018-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987

Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.19.6-200.fc28.x86_64 amd64

Kotlin 不是核心插件,因此您必须包含版本。名称也不同,当使用 plugins 配置时:

plugins {
    id "org.jetbrains.kotlin.jvm" version "1.3.11"
}

如果您使用 apply 函数,您仍然可以使用简单名称:

apply plugin: "kotlin"

您可以在 Targeting the JVM 上找到此信息。