Publish test jar with artifactory plugin

plugins

(Nuno Miguel Marques dos Santos) #1

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!


(Schalk Cronjé) #2

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.


(Nuno Miguel Marques dos Santos) #3

so I could have two different artifactoryPublish tasks?


(Schalk Cronjé) #4

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


(Benjamin Muschko) #5

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.