How to use maven-publish Gradle plugin from kts script


#1

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?


#2

Ah there is an example for that: https://github.com/gradle/kotlin-dsl/blob/master/samples/maven-publish/build.gradle.kts