Hello.
I have the following file Versions.kt
, which contains this:
package org.kopi.galite.gradle
object Versions {
const val SPRING_BOOT = "2.7.14"
}
I have the following file build.gradle.kts
, which contains this:
import org.kopi.galite.gradle.Versions
plugins {
kotlin("jvm") apply true
id("org.springframework.boot") version Versions.SPRING_BOOT
}
When I try to build my project, I get the following error:
Unresolved reference: Versions in build.gradle.kts
I would like to keep my structure like this, i.e., having one file that contains the versions of the different frameworks and dependencies, and calling them, instead of hard-coding the versions in the build.gradle.kts files.
Calling Versions.SPRING_BOOT
outside of the plugins
block does not generate any type of errors, and works completely fine. However, calling Versions.SPRING_BOOT
inside the plugins
block generates the above error for some reason.
What could I do to be able to use my constant SPRING_BOOT
in the plugins block in my build.gradle.kts
file?
Note that I am using Gradle 7.0 with Kotlin DSL.