Is there an easier way to force Gradle to use the ...
# gradle
m
Is there an easier way to force Gradle to use the same module version for all Kotlin modules?
Copy code
configurations {
		all {
			resolutionStrategy.eachDependency {
				if (requested.group == "org.jetbrains.kotlin") {
					useVersion(embeddedKotlinVersion)
					because("All Kotlin modules must have the same version.")
				}
			}
		}
	}
Something like that being part of the Kotlin Gradle Plugin would be great, but with configurable version of course.
c
isn't it working like that already if you apply kotlin plugin? My understanding was that plugin's version is used for all relevant dependencies.
m
There was a transitive dependency in my project which caused Gradle to downgrade
kotlin-reflect
from Kotlin 1.3 to 1.2 in some configurations even though I had
testImplementation(kotlin("reflect"))
in my project.
c
in that case what you wrote is your best bet.
n
you can also do
testImplementation(kotlin("reflect", embeddedKotlinVersion))
i think
m
I haven’t used it, but shouldn’t dependency constraints help here?
n
this? https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:dependency_constraints looks like this could be done in a init script or on the rootproject via
allProjects { dependencies { contraints { .. } } }
👍 1
i will alos have to play with that new feature