Hi all - can code built in `buildSrc/src/main/kotl...
# gradle
r
Hi all - can code built in
buildSrc/src/main/kotlin
access a constant in
buildSrc/build.gradle.kts
? At the moment I have
Copy code
plugins {
  kotlin("jvm") version "1.4.10"
}
in
buildSrc/build.gradle.kts
and
const val kotlinVersion = "1.4.10"
in
buildSrc/src/main/kotlin/DependencyVersions.kt
and having to change two files to update kotlin universally rather than one is irritating me.
l
You might be looking for #gradle-refresh-versions that allows to centralize the version declarations and supports buildSrc
r
I’ll have a look at it, thanks
j
There is a trick so you can do that
r
I meant to ask this in the gradle slack, as it’s not really a kotlin specific thing, so I’m continuing research there.
j
• Inside
buildSrc
, create another
buildSrc
folder • Add a
build.gradle.kts
file with the content you can see in the image (you can change the file names you include) • Now you should be able to use
Versions.kotlin
in the
dependencies
block
buildSrc/buildSrc/build.gradle.kts
And
buildSrc/build.gradle.kts
r
Cool, I’ll give that a try, thanks