How to use maven-publish Gradle plugin from kts script

Hello! I’m trying to use the maven-publish Gradle plugin in my build.gradle.kts script. The Kotlin plugin correctly picks up publishing and publications functions, but the mavenJava() is missing:

publishing {
  publications {
    mavenJava(MavenPublication) {
      ...
    }
  }
}

Funny thing is that Intellij can not resolve the mavenJava function even in Groovy Gradle script counterpart, but apparently it exists and it works. Please, how can I import that mavenJava function so that I can call it?

Ah there is an example for that: kotlin-dsl-samples/build.gradle.kts at master · gradle/kotlin-dsl-samples · GitHub