Few of our project libraries will produce java 8 and java 7 artifact jars differentiated by classifier. ‘jdk7’ (if it is jdk7 compiled) and no classifier (if it is jdk8 compiled) and these are being published to our internal repositories.
let’s say like
foo-1.0.0.jar
foo-1.0.0-jdk7.jar
ivy-1.0.1.xml
and coming to consuming side, projects building on java 8 will consume the above mentioned dependencies with usual practice (with no classifier) and any projects building on java 7 consume them with classifier - jdk7 along with group, name and version.
But we identified an issue when Java 7 consumer projects when it got dependencies foo:1.0.0:jdk7
as direct and foo:1.0.0
as transitive
We are finding the consuming project ended up having both
foo:1.0.0:jdk7 foo:1.0.0
in the dependency graph and not resolved any one.
I tried using Dependency dependencySubstitution
(with classifier) and also tried by force
strategies (with classifier) and both these approaches not worked.
Is there any way, we can tell Gradle dependency resolution to consider dependencies with classifier has higher or lower?