Project dependencies on archives


(tulsoba) #1

I have the following multi-project:

parent
  -> subA
      -> build.gradle
  -> subB
      -> build.gradle
  -> build.gradle
  -> settings.gradle

subB produces a zip file with some external dependencies. In project subA I need to depend on subB but not on the source code but on the assembled zip file. in subA/build.gradle I have:

configurations {
  myConf
}
  dependencies {
  myConf project(':subB', configuration: 'zipConf')
}
  task preparePackage << {
  copy {
    from configurations.myConf
     into new File("$buildDir/tmp").getPath()
  }
}

and in subB/build.gradle:

configurations {
  zipConf
}
  artifacts {
  archives myZipTask
  zipConf zip
}

but when I build subA it fails with:

> No such property: zip for class: org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler

how do I depend on a zip archive build in another module?


(Peter Niederwieser) #2

What is the ‘zip’ following ‘zipConf’ supposed to refer to? Shouldn’t it be ‘zipConf myZipTask’? Why are you adding ‘myZipTask’ to ‘archives’?


(Alan Lee) #3

I have similar question.

I have no idea. Now if i run the subA preparePackages, it will look for the dependencies of subB inside myConf.

But at this stage the subB has no such zip and give me file not found error.

My target is to zip the subB when calling prearePackages in subA. So when should i call zip for subB?

I saw many examples related to java…If dependencies is compile, it will compile the project. But what should i do if i want to zip the file?