简体   繁体   中英

upload multiple jars to repo in gradle

In my build.gradle file, I am creating multiple jars with different compilation for each using the following:

build.gradle

task devJar(Type: Jar){
  baseName = 'quickjar'
  version = project.version
  classifier = 'dev'
  from('src/resources'){
    include' dev.properties
    }
  from(sourceSets.main.output){
    include '**/*.*'
    }
}

build.finalizedBy(devJar, anotherJar, anotherJar, uploadArchives)

uploadArchives{
    repositories {
    mavenDeployer {
        repository(url: uri('../../repo'))
    }
  }
}

This however is only creating one jar file in my repo and not all the jars within my build file. How might I achieve uploading multiple jars to the repo that are created within this build file?

Have you tried adding your devJar task as an artifact ?

task devJar(Type: Jar) {
    //...
}

task qaJar(Type: Jar) {
    //...
}

task prodJar(Type: Jar) {
    //...
}

artifacts {
    archives devJar, qaJar, prodJar
}

uploadArchives {
    //...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM