Gradle Artifactory插件失败,"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'

我已经按照这个和这个类似问题的答案给出的建议做了,但还是没有运气。

我使用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的评论,我意识到这个问题是我在构建中使用了JFrog Artifactory v4.4.3插件。我还在我的jenkins中使用了Artifactory插件v2.6.0,所以它们发生了冲突。解决方案是从我的build.gradle中删除JFrog Artifactory v4.4.3插件。

相关内容

最新更新