Generated zip file does not contain project archives/dependencies


(tulsoba) #1

Using gradle 1.5 and the gradle maven plugin. I have 3 projects (a multi-project): A, B and C.

A and B each creates an ear file containing a war file. Project C depends on A and B and zips these 2 ear files into a zip file which is located in “$buildDir/distributions”:

dependencies {
// myAConf project(path: ':A', configuration: 'zipConf')
 myAConf project(path: ':A:ear', configuration: 'earConf')
 myBConf project(path: ':B:ear', configuration: 'earConf')
}
    task myFetch<< {
 copy {
  from configurations.myAConf
   into file("$buildDir/staging")
 }
   copy {
  from configurations.myBConf
   into file("$buildDir/staging")
 }
   copy {
  from file("../A/resources/myconfig.properties")
  into file("$buildDir/staging")
 }
}
  task myZip(dependsOn: 'myFetch', type: Zip){
 from "$buildDir/staging"
}

This works fine. The zip file is created and contains the two ear files. Now I would like to add the zip file as an artifact which will get uploaded to artifactory (the other artifacts/ears are already uploaded when I run with ‘uploadArchives’)

I have tried to following this guide:

http://www.gradle.org/docs/current/userguide/userguide_single.html#artifact_management

And have added the following to the above build.gradle file:

configurations {
    myOtherConf
    }
  artifacts {
   myOtherConf myZip
}

But the uploaded zip file when running with ‘uploadArchives’ does not contain the two ear files. I have read that the suffix of the task is defined by the listed artifacts so I have also tried:

artifacts {
   archives myZip
}

But it gives the same result

I have also tried the file approach but with no success either.

Any ideas on how to add this zip archive with the full content?


(tulsoba) #2

I have not found any solution for this does anyone have a suggestion?