preferProjectModules

Gradle can resolve conflicts purely by version number or prioritize project dependencies over binary. The default is by version number.

This applies to both first level and transitive dependencies. See example below:

plugins {
    id 'java' // so that there are some configurations
}

configurations.all {
  resolutionStrategy.preferProjectModules()
}

Since

3.2