我跑gradle(2.3),我得到:
>无法应用插件[id'com.jfrog.artifactory'] >不能与类的org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'上课org.jfrog.gradle.plugin.artifactory投对象org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@6b6c7be4。 dsl.ArtifactoryPluginConvention'当然看起来像一个类路径问题,但我确实有这个项目和一个兄弟项目使用这套相同的gradle / artifactory配置,一个工作,另一个不工作。两者都是同一顶级项目的一部分。相同的JDK(1.8.0_20)。同一个Gradle。同样的东西。
我很困惑...
在遇到其他人有同样问题的情况下回答此问题。问题是,当我将各种位添加到兄弟项目时,这意味着我有两个项目定义了buildscript部分。 buildscript { ... 依赖关系{ classpath组:'org.jfrog .buildinfo',名称:'build-info-extractor-gradle',版本:'3.0.1'} }显然,在类路径中存在两个不同版本的依赖关系,因此出现了错误。
解决方案是将buildscript位移动到主项目中,以便这些依赖项只定义一次。
Here's the configuration to get the artifactory plugin:
buildscript { repositories { mavenCentral() maven { url 'jcenter.bintray' } } dependencies { classpath group:'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1' } } apply plugin:'com.jfrog.artifactory' apply plugin:'ivy-publish' ...some publish spec stuff...I run gradle (2.3) and I get:
> Failed to apply plugin [id 'com.jfrog.artifactory'] > Cannot cast object 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention@6b6c7be4' with class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention' to class 'org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention'Certainly looks like a classpath issue, but I literally have this project and a sibling project using this same set of gradle/artifactory configurations and one works and the other does not. Both are part of the same top level project. Same JDK (1.8.0_20). Same Gradle. Same everything.
I'm baffled...
解决方案Answering this in case someone else has the same issue. The problem was that when I added the various bits to the sibling project that meant I had two projects defining the buildscript {} section.
buildscript { ... dependencies { classpath group:'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1' } }Apparently that caused two different versions of the dependency to exist in the classpath, hence the error.
The solution was to move the buildscript bit into the master project so those dependencies are only defined once.
更多推荐
Gradle artifactory插件说“无法投射对象”org.jfrog.gradle.plugin.artifactory.dsl.Artifactory
发布评论