How to call a constant in 'plugins' block in a build.gradle.kts file?

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.

You should strongly consider switching to version catalogs instead. You can achieve your mentioned goal in a standard built-in way that also has other advantages.

If you really want to do it like that, you can try using the fully-qualified name instead of relying on the import, but I’m not sure that will work. The plugins block is extracted and applied to a dummy project to find out which type-safe accessors need to be generated.