I want to do an 'apply from: ./gradle/script/common.gradle' in my root build.gradle and have it be available to all of my subprojects.
I've tried putting the apply in the 'subprojects' but because the path is relative it won't always resolve, (the subprojects are not flat). I've also put it outside of the subprojects at the root but then the targets aren't resolved by the subprojects.
I haven't been able to find a way to get the working directory in a way the 'apply from:' likes, or how to get the root directory or directory that the original gradle script is being executed from.
In your root build.gradle.
:
allprojects { // or: subprojects { ... }
apply from: "gradle/script/common.gradle"
}
Should you ever need an absolute path to such a script, you can always do "$rootProject.projectDir/gradle/script/common.gradle"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With