Gradle Artifactory插件错误

时间:2015-08-18 12:40:03

标签: eclipse gradle artifactory

我的gradle版本是2.2.1。

我正在尝试在gradle(apply plugin: 'artifactory'

中使用artifactory插件

这是我的代码:

buildscript {
    repositories {
        maven {
            url 'http://172.14.3.93/artifactory/plugins-release'

        }

    }
    dependencies {
        classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
    }
}

allprojects {
    apply plugin: 'artifactory'
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            maven = true

        }
    }
}

当我运行gradle build时,这就是我得到的:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Workspace\GradleConfiguration\build.gradle' line: 100

* What went wrong:
A problem occurred evaluating root project 'GradleConfiguration'.
> Failed to apply plugin [id 'artifactory']
   > Could not find method add() for arguments [artifactoryPublish, class org.jfrog.gradle.plugin.artifactory.extractor.BuildInfoTask] on task set.

* Try:
Run with --info or --debug option to get more log output.

此外,当我删除与神器相关的所有代码并仅留下apply plugin: 'artifactory'时,我收到此错误:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\OnRights_Workspace\GradleConfiguration\build.gradle' line: 86

* What went wrong:
A problem occurred evaluating root project 'GradleConfiguration'.
> Failed to apply plugin [id 'artifactory']
   > Plugin with id 'artifactory' not found.

* Try:
Run with --info or --debug option to get more log output.

2 个答案:

答案 0 :(得分:2)

您的插件版本太旧了。尝试使用最新的(3.1.1)。

答案 1 :(得分:1)

buildscript块告诉Gradle它应该在哪里寻找插件。你告诉它它应该只在http://172.14.3.93/artifactory/plugins-release搜索。

您是否100%确定“神器”插件实际上是在那里托管的?

如果你把jcenter放在那里,比如the instructions say,它会更好吗?

buildscript {
   repositories {
     jcenter()
   }
   dependencies {
     classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0"
   }
}
apply plugin: "com.jfrog.artifactory"