I have a multi-project repository. The project works fine currently, and works well when I run a command like ./gradlew clean publishToMavenLocal
from the root directory.
Now, I want to customise the dependency resolution for all the projects in the repository. So in the root project’s build.gradle
file, I do:
subprojects {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'some-name') {
details.useVersion 0.0.2
}
}
}
}
But when I try to run the command ./gradlew clean publishToMavenLocal
from the root directory again, I get an error:
Cannot resolve external dependency <some-dependency>
because no repositories are defined.
Why does this error only show up when I am trying to customise the resolution strategy? What am I missing? I read a couple of StackOverflow answers and tried to insert repositories { xxx }
in all sub projects but the same error still occurred.