Is there way in Gradle how to call parent function from subproject? If I have parent project and function defined as:
def testMethod() {
println("TestMethod called from directory ${project.projectDir}")
}
and subproject as:
task subTest << {
println("I'm subTest task from ${project.projectDir}")
testMethod()
}
calling this from commandline results in:
Could not find method testMethod() for arguments [] on root project 'subsys1'
Could not find method testMethod() for arguments [] on root project 'subsys1'
Means that Gradle thinks that subsy1 is the root project, whereas your parent project should be the root project. This means that you have more than 1 settings.gradle, and it thinks that subsys1 is the start of the project hierarchy. There should only be 1 settings.gradle file, which should reside in the root project. There you configure each of the subprojects. They don't get their own settings.gradle files.
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