However i think that the suggested solution can’t work.
When iterating into eachDependency clouser, we can detect the higher version of a module and then set the useVersion later on under the Strategy, but we do not have the complete graph cause maybe the new version depends on other module with higher version we did not detect under eachDependency clouse.
For example let say we found for lbrary A moulde x version 1 and module y version 2 so we upgrade x to version 2 but when we do that x can bring more dependencies we did not iterate under eachDependency clouser.
We need somehow ask Gradle to calculate the graph and for each library found collect its modules and set to the highest version found. Then recalculate again and again till it converge. Mathematically speaking i think we can prove that it must converge (with detecting cycle) .