java - Transitive project dependencies not found -


i have flat project hierarchy 4 projects. lets call them b,c,d,m , have following linear dependencies :

b -> c -> m -> d

-> = "depends on"

projects b,c , m have build.gradle , settings.gradle. settings.gradle includeflat on dependent projects. in case of b includeflat('d', 'm', 'c'). build.gradle defines defines dependency project depends on. in case of b compile project('c').

if try build project b run problem after parsing b, gradle tries parse build.gradle of c , fails because can't find m.

* went wrong: problem occurred evaluating project ':c'. > project path 'm' not found in project ':c'. 

i think relevant part of debug output is:

included projects: [root project 'b', project ':c', project ':d', project ':m'] 

it seems gradle sorts include in alphabetical order, despite defined in other settings.gradle files , in build.gradle dependencies.

when created c wondered why need include d includeflat settings. there works because orders includes d,m.

the "solution" see remove project dependencies in b , depend on build jar of c. has huge (game breaking) disadvantage, when change in d need full build, publish , "refresh nexus" cycle till changes visible. because c, m , d still in active development isn't option.

to fix need tell eclipse plugin when discovers jar dependency project adds project dependency classpath instead of jar dependency.

you seem have misconceptions how gradle multi-project builds work. here facts might understand what's going on:

  • a gradle build can have single settings.gradle.
  • the order of include statements in settings.gradle has no relevance.
  • execution dependencies between tasks, not between projects. example, depending on project(":m") shorthand depending on default configuration of project. gradle translates dependency on tasks in m responsible building artifacts of default configuration. note depending on project not mean tasks in project run before task in depending project.
  • a multi-project build has logical project hierarchy. ":m" absolute project path (: denotes root project), whereas "m" relative project path. relative paths interpreted relative current project.

to more in-depth understanding of multi-project builds, recommend study "multi-project builds" chapter in gradle user guide, , multi-project build samples in full gradle distribution.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -