'BintrayExtension' 类型的扩展名不存在

Extension of type 'BintrayExtension' does not exist

我的项目build.gradle:

...
plugins {
    id "maven-publish"
    id "com.jfrog.bintray" version "1.8.5"
}

我的库模块build.gradle:

apply plugin: 'kotlin'
apply plugin: 'java-library'
apply plugin: 'com.android.lint'
...
if (project.rootProject.file('local.properties').exists()) {
    apply from: rootProject.file('deploy-bintray.gradle.kts')
}

我的库模块deploy-bintray.gradle.kts:

import com.jfrog.bintray.gradle.BintrayExtension

apply(plugin = "maven-publish")
apply(plugin = "com.jfrog.bintray")

configure<BintrayExtension> {...}
configure<PublishingExtension> {...}

这是我从 gradle assemble:

得到的错误

Extension of type 'BintrayExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension, KotlinJvmProjectExtension, KotlinTestsRegistry, DefaultArtifactPublicationSet, ReportingExtension, SourceSetContainer, JavaPluginExtension, JavaInstallationRegistry, LintOptions, PublishingExtension, BintrayExtension]

我添加了:

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

    dependencies {
        classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5")
    }
}

但我得到相同的输出...如果我打开 BintrayExtension.groovy 包名 com.jfrog.bintray.gradle 有这个警告:

Package name mismatch. Actual: 'com.jfrog.bintray.gradle', expected: ''

和 class:

Class 'BintrayExtension' already exists in 'com.jfrog.bintray.gradle'

我在这里错过了什么?

解决方案正在替换:

id "com.jfrog.bintray" version "1.8.5"

与:

plugins.apply(BintrayPlugin::class.java)

非常感谢 Tom Eyckmans pointing 这件事。