How to make properties in the file of a custom Gradle plugin available in the consuming project

I am writing a custom Gradle plugin in Java. Internally, it sets some fundamental properties in the file, e.g., the Kotlin version to apply.

versionKotlin = 1.4.10


plugins {
    id 'java-gradle-plugin'

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$versionKotlin"

Then, within the code of the custom plugin, Kotlin plugin is first applied, and then configured:

public class CustomPlugin implements Plugin<Project> {

    private static final String VERSION_KOTLIN = "1.4.10";

    public void apply(@NotNull Project project) {
        project.getTasks().withType(KotlinCompile.class, task -> {

    private String extractKotlinApiVersion(String versionKotlin) {
        return versionKotlin.substring(0, versionKotlin.indexOf('.', versionKotlin.indexOf('.') + 1));

Now, the VERSION_KOTLIN constant in the code of the custom plugin is duplicated information. Is there a more-or-less elegant way to pass the properties from the file to the code that is executed by the consuming project?

You can directly try accessing project.versionKotlin. It should work