1

I followed the solution given here: upload artifact to artifactory using gradle, but it is not working for me.

Here is my code:

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
        }
    }
}

The error is:

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

GAV used for artifactory plugin is:

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

What is wrong here ? can someone point me to DSL/API doc of artifactory plugin version 2.1.0 My gradle version is 1.11

Community
  • 1
  • 1
Sundeep Gupta
  • 1,887
  • 3
  • 24
  • 35

1 Answers1

2

As explained in the user guide, artifactory plugin of version 2.X is intended to work with maven plugin, not maven-publish plugin. For working with publications please use artifactory-publish plugin of version 2.X, or, preferably, use version 3.0 of com.jfrog.artifactory plugin. It is intended to work with maven-publish publications and compatible both with Gradle 1 and Gradle 2.

This answer contains a fully working example.

Community
  • 1
  • 1
JBaruch
  • 22,610
  • 5
  • 62
  • 90
  • Thanks JBaruch. I'm not sure if I can use artifactory 3.x, due to dev process limitations. My requirement is to publish the jar created by custom sourceSet (say, integTest) to artifactory. How can this be done with artifactor 2.X ? – Sundeep Gupta Aug 13 '14 at 09:15
  • 3.0 that I mention refers to gradle plugin version, not to Artifactory version. You can use artifactory gradle plugin v3.0 with any Artifactory version. – JBaruch Aug 13 '14 at 14:06