gradle - How do I add dependencies to grandchildren projects from root? -


i have multi level nested project goes 3 levels , add dependency 3rd level root project build.gradle file. how do that?

for example, have following project structure. gp (grandparent) @ root, p1 , p2 direct subprojects under gp, , gc1 , gc2 subprojects under p1 , gc3 , gc4 subprojects under p2.

gp
|____ p1
...........|____gc1
...........|____gc2

|____ p2
...........|____ gc3
.......... |____ gc4

from gp's build.gradle, want add dependencies gc1, gc2, gc3 , gc4. tried following in build.gradle of gp:

configure(subprojects) {    compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.7' } 

it fails message when trying process gc1, gc2, gc3 or gc4, passes p1 , p2.

no signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.defaultdependencyhandler.compile() applicable argument types: (org.gradle.api.internal.file.collections.defaultconfigurablefilecollection) values: [file collection] possible solutions: module(java.lang.object)

my settings.gradle:

include 'p1', 'p1:gc1', 'p1:gc2',... 

that's correct message gradle. indeed there's no such method. you're missing dependencies block. should be:

configure(subprojects) {   dependencies {     compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.7'   } } 

here can find demo. run gradle :p1:gc1:printdeps verify works.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -