bill_phillips
(william.r.phillips.jr)
January 30, 2015, 11:13pm
1
We have a multi-project build with a bunch of libraries stored in a subdirectory:
root/
libraries/
lib-1/
lib-2/
lib-3/
lib-4/
war/
Is it possible declare all of the lib projects as compile dependencies in the war project gradle file without naming each one individually?
Mark_Viera
(Mark Viera)
January 31, 2015, 4:19am
2
You could simply iterate over the collection of subprojects.
dependencies {
subprojects.each {
compile project(it.path)
}
}
bill_phillips
(william.r.phillips.jr)
February 21, 2015, 5:37am
3
How would I turn the directory of libraries into a collection of subprojects?
bill_phillips
(william.r.phillips.jr)
February 21, 2015, 5:40am
4
Also, would I have to change the settings.gradle in the root directory?
If so, would I just add the text “libraries”, or would it be something different?
Mark_Viera
(Mark Viera)
February 21, 2015, 9:20pm
5
Yes, you have to change settings.gradle in order to include those subproject in your multi-project build. If you wanted to do it in a way that didn’t involve explicitly listing each library you could do something like this:
new File(rootDir, ‘libraries’).eachDir {
include “:libraries:$it.name ”
}