How do I define a collection of dependencies?


(Sason Ohanian) #1

Hi!

I have a project with the application plugin applied with subprojects. I want to add a set of runtime dependencies to the root project. system has a hierarchy of projects ordered some kind of logical manner. Example:

root > subsystems >> client >>> clientproject1 >>> clientproject2 >> common >>> commonproject1 >>> commonproject2 >> server >>> serverproject1 etc…

I have something like this in mind:

apply plugin:'java'
apply plugin:'application'
mainClassName = "package.mainclass"
  repositories {
 maven ...
}
  dependencies {
        // This doesn't work
 runtime subprojects.findAll(){ project ->
  project.path.contains("client") ||
  project.path.contains("common")
 }
        // This works but is not what I want
 runtime project(:subsystem:client:clientproject1)
        runtime project(:subsystem:client:clientproject2)
        runtime project(:subsystem:commonproject1)
        // And 20 more lines like these
}
  subprojects {
         ...
}

I’m getting the error message when I execute “gradle distZip”:

FAILURE: Build failed with an exception.
  * What went wrong:
Could not determine the dependencies of task ':distZip'.

I’m probably approaching this the wrong way.

Any suggestion?


(Peter Niederwieser) #2

Running with ‘–stacktrace’ may reveal the problem.