In my multiproject setup like below
RootProject
-buildSrc
-DirectoryA
-SubProjectA1
-SubProjectA2
-SubProjectA3
-DirectoryB
-SubProjectB1
-SubProjectB2
-DirectoryC
-SubProjectC1
-SubProjectC2
I have a task that is created on the root level (In RootProject-> build.gradle). Because I want this task to be invoked from the root level like this
gradle myTask
But if I only configure subprojects like below
configure(mySubprojects()) {
...
dependencies { ... }
repositories {...}
}
Then in myTask configurations.runtime does not contain external dependencies.
Even though I iterate through every subproject and grab these dependencies.
task myTask(type: JavaExec) {
...
mySubProjects().each{ classpath = classpath.plus(it.configurations.runtime) }
...
}
However if I also configure the root project in the root build.gradle as below, the problem goes away and all dependencies are included.
configure(project) {
...
dependencies { ... }
repositories {...}
}
Could someone please point me in some direction? I’m probably missing something here. But I really wouldn’t want to configure that root project just for the sake of having dependencies included in my subprojects. I was hoping they are already there since I configure them with configure(mySubProjects())
mySubprojects btw is just a collection of subprojects, had to use it to avoid gradle adding empty directories.
Thanks!