Best way to apply same transitive dependency versions across all configurations

If different versions are calculated for a dependency in different configurations, what is the best way to apply the same version (in my case, the newest of the selected versions) across all configurations without explicitly specifying any version?

e.g., if a transitive dependency X is normally calculated to be version 1 in configuration A, but is calculated to be version 2 in configuration B, I want configuration A to also use version 2 of X. I don’t, however, want to explicitly write in any file that version 2 of X should be used; I want it to be applied on the fly using a version ordering algorithm (presumably one builtin to Gradle).