Gradle Artifactory 插件错误

Gradle Artifactory plugin error

我的gradle版本是2.2.1.

我正在尝试使用 gradle (apply plugin: '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 构建时,这就是我得到的:

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.

buildscript 块告诉 Gradle 它应该在哪里寻找插件。您已经告诉它应该只在 http://172.14.3.93/artifactory/plugins-release.

处搜索

您是否 100% 确定 "artifactory" 插件实际托管在那里?

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

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

您的插件版本太旧。尽量使用最新的(3.1.1).