Publish test jar with artifactory plugin

Hi everyone,

I’m currently using the Gradle Artifactory Plugin (https://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin) to deploy my jars.

Is there a way that I can specify which jar I want to upload to Artifactory with this plugin?

e.g. some times I just want to publish my normal jar and sometimes I want to publish my test jar.

Do I have to resort to a custom maven publisher task or is there some way this can be achieved with the plugin?

Thanks everyone!

If you use the new publishing mechanism in Gradle I think you can tell the artifactoryPublish task or the artifactory extension block which publications to push. See https://www.jfrog.com/confluence/display/rtf/gradle+artifactory+plugin.

so I could have two different artifactoryPublish tasks?

AFAIK it is not possible with that plugin - it does not follow plugin writing convention.

I guess you could assign different publications based on some logic via the method artifactoryPublish.publications. For example:

def selectedPublications = System.getProperty('test') ? ['testPublication'] : ['normalPublication']

artifactoryPublish {
    publications(selectedPublications)
}

Of course this would assume that you declare different publications for each use case.