The Governor
The Governor

Reputation: 1192

Uploading jar to maven artifactory on war project

I have a multi-project gradle build. One of the child projects called project2 uses the war plugin. I want this child project to generate a both a war and a jar, but I would upload only the jar file to a maven artifactory. I did the following in the parent build.gradle file:

//project2 has REST API and produces a war
def uploadables = [project(':project1'), project(':project2')]
configure(uploadables) {
    apply plugin: 'maven'
    uploadArchives {
       repositories.mavenDeployer {
          repository(id: 'repoid', url: 'http://myartifactory') {
            authentication(userName: 'mavenuser', password: 'secret')
          }

       }
    }
}

This rightfully produces a project1 jar and a project2 war and uploads project1 jar. However this also uploads project2 war which is something I don't want. I know I can make gradle generate a jar for project2 by adding the jar task to the gradle command line, but how do I tell gradle to upload project2 jar to the artifactory.

Upvotes: 1

Views: 609

Answers (1)

Related Questions