Transitive vs module dependency issue

Good afternoon,

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
project :api
-– compile

com.company.web:api:1.1.6

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:

configurations.compile.resolutionStrategy.dependencySubstitution {
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.

Gradle uses project.group and project.name for project dependencies. Make sure that your api project has these set correctly.

Thanks a lot, now I see the problem, we set Maven publishing properties but they do not correspond to project name/goup