Kotlin MPP and gradle - local maven publication does not work with .kts script

Another day - another glitch from gradle.

Can anybody explain please, why Kotlin MPP project setup with groovy script publishes artifacts to local maven repo, and almost identical .kts variant does not do it?

Groovy:

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VER"
    }
}

plugins {
    id 'org.jetbrains.kotlin.multiplatform' version "$KOTLIN_VER"
    id 'maven-publish'
}

allprojects {
    version '0.0-SNAPSHOT'
    group 'com.gradleglicthes'

    repositories {
        mavenCentral()
        mavenLocal()
    }

}

subprojects {

    // maven publication
    apply plugin: 'maven-publish'
    apply plugin: 'org.jetbrains.kotlin.multiplatform'


    publishing {
        repositories {
            mavenLocal()
        }
    }

    kotlin {
        js {
            browser {
                testTask {
                    enabled = false
                }
            }
            binaries.executable()
        }.compilations.configureEach {
            kotlinOptions.noStdlib = "false"
            kotlinOptions.sourceMap = "true"
            kotlinOptions.sourceMapEmbedSources = "always"

            kotlinOptions.metaInfo = true
        }

        jvm().compilations.configureEach {
            kotlinOptions.jvmTarget = "1.8"
        }

        sourceSets {
            commonMain {
                dependencies {
                    implementation kotlin('stdlib')
                }
            }

            jvmMain {
                dependencies {
                    implementation kotlin('reflect')
                }
            }

            commonTest {
                dependencies {
                    implementation kotlin("test")
                }
            }
        }
    }
}

kotlin {
    jvm()
}

Kotlin DSL:

val kotlinVersion = extra["KOTLIN_VER"] as String

repositories {
    mavenCentral()
    mavenLocal()
}

plugins {
    kotlin("multiplatform") version "1.9.20"
    id("maven-publish")
}

group = "com.gradleglicthes"
version = "0.0-SNAPSHOT"


subprojects {
    repositories {
        mavenCentral()
        mavenLocal()
    }

    apply(plugin = "maven-publish")
    apply(plugin = "org.jetbrains.kotlin.multiplatform")

    publishing {
        repositories {
            mavenLocal()
        }
    }

    kotlin {
        js {
            browser {
                testTask {
                    enabled = false
                }
            }
            binaries.executable()
        }.compilations.configureEach {
            kotlinOptions.noStdlib = false
            kotlinOptions.sourceMap = true
            kotlinOptions.sourceMapEmbedSources = "always"

            kotlinOptions.metaInfo = true
        }

        jvm().compilations.configureEach {
            kotlinOptions.jvmTarget = "1.8"
        }

        sourceSets {
            commonMain {
                dependencies {
                    implementation(kotlin("stdlib"))
                }
            }

            jvmMain {
                dependencies {
                    implementation(kotlin("reflect"))
                }
            }

            commonTest {
                dependencies {
                    implementation(kotlin("test"))
                }
            }
        }
    }
}

kotlin {
    jvm()
}

Example with two project variants is attached:
MavenPublicationWithKts.zip (5.4 KB)

The command I am running:
gradle clean build publishToMavenLocal

And JetBrains ticket on this: https://youtrack.jetbrains.com/issue/KT-65340/Kotlin-MPP.-Publishing-to-maven-local-repo-works-with-groovy-and-does-not-work-with-kts