没有使用gradle artifactory插件发布到artifactory

时间:2014-08-13 05:57:31

标签: gradle artifactory

我按照此处给出的解决方案:upload artifact to artifactory using gradle,但它不适用于我。

这是我的代码:

apply plugin: 'artifactory'
apply plugin: 'maven-publish'

/* Specify the repositories to be used for downloading artifacts */
repositories {
    maven {
        url = "${artifactory_contextUrl}/repo"
    }
}
/* Define the repository (in artifactory) where artifactoryPublish task should publish */
artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = "${artifactory_repoKey}" 
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }

    defaults {
        publications ('integTestPublish')
    }

}
publishing {
    publications {
        integTestPublish(MavenPublication) {
            setArtifactId(project.name + '-' + integTestJar.appendix)
            artifact integTestJar.archivePath
        }
    }
}

错误是:

> Could not find method defaults() for arguments [build_3a14r6bjhcvi883gaucf1jd8f0$_run_closure1_closure5_closure9@71bc1581] on root project 'samples'.

用于神器插件的GAV是:

classpath group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.0'

这里有什么问题?有人可以指向我的神器插件版本2.1.0的DSL / API文档 我的gradle版本是1.11

1 个答案:

答案 0 :(得分:1)

正如the user guide中所述,版本2.X的artifactory插件旨在使用maven插件,而不是maven-publish插件。要使用publications,请使用版本2.X的artifactory-publish插件,或者最好使用com.jfrog.artifactory插件的3.0版。它旨在与maven-publish出版物一起使用,并与Gradle 1和Gradle 2兼容。

This answer包含一个完整的示例。