Gradle Artifactory 插件失败 "Cannot cast object to ArtifactoryPluginConvention"

Gradle Artifactory plugin failing with "Cannot cast object to ArtifactoryPluginConvention"

我正在尝试在 Jenkins 中使用 JFrog Artifactory 插件,但是当我尝试构建项目时。我收到此错误:

Failed to apply plugin [id 'com.jfrog.artifactory'] Cannot cast object
'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@2f54f83b' 
with class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention' to class 
'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'

我已经执行了 and 类似问题的答案中的所有建议,但仍然没有运气。

我使用 Gradle v2.14.1,Artifactory 插件 v2.6.0 和 JFrog Artifactory v4.4.3

编辑:

这是我项目的 gradle 文件

buildscript {
repositories {
    jcenter()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.3"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {

TAG = "v" + "$VERSION_NAME" + "#" + String.format("%06d", Integer.parseInt("$VERSION_CODE"))
repositories {
    jcenter()
    maven {
        url "https://plugins.gradle.org/m2/"
    }

}
}


task clean(type: Delete) {
delete rootProject.buildDir
}

apply from: 'sonar.gradle'

感谢 EyalBenMoshe 的评论,我意识到这个问题是我在我的 build.gradle 文件中使用了 JFrog Artifactory v4.4.3 插件,我还在我的 jenkins 中使用了 Artifactory 插件 v2.6.0 ,所以他们在哪里碰撞。解决方案是从我的 build.gradle.

中删除 JFrog Artifactory v4.4.3 插件