Faced pretty interesting behavior I can not explain. Situation is pretty simple. We have small multi-module project with two submodules, one is api library, i.e. ‘com.company.web:api’, second submodule is a war application which has it’s own source, UI files and depends on api module as ‘compile project(":api")’. Recently new dependency was introduced in war module (another api jar) which also depends on ‘api’, adding transitive dependency on it. The problem is even though transitive dependency is a bit out of date Gradle does not perceive it as a conflict but packages two version of jar into war file, causing runtime issues:
~/projects/web/service$ gradle -q dependencyInsight --configuration compile --dependency api
GroupId and ArtifactId are the same, so I would expect Gradle to identify this as conflict, while it keeps thinking that these are absolutely different artifacts. For sure quick workaround is:
substitute module(‘com.company.web:api’) with project(’:api’)
But I have a feeling that it might be kind of a bug, or feature I don’t understand. Checked dependency management manual and did not find anything related to this situation.
Any advice is appreciated.