I want to migrate from Groovy to Kotlin DSL in my gradle build script. I have 2 scripts in the project: build.gradle and publish-maven.gradle which is attached in the first one.
For Groovy I apply the script like that:
apply from: "${rootProject.projectDir}/publish-maven.gradle"
For Kotlin, I found the same code will look like that:
apply(from = "publish-maven.gradle.kts")
But publish-maven.gradle.kts isn't attached to build.gradle.kts. At the top of the script the IDE constantly shows warning:
Code insight unavailable (configuration for this script wasn't received during the last Gradle project import)
and Kotlin syntax isn't recognised.
I also tried
apply(from = "${rootProject.projectDir}/publish-maven.gradle.kts")
or have found other examples but non of them helped.
What do I have to do to apply this script? Or the general question is how can I split build script into several files?
Gradle version: 6.7; JDK: 1.8; IDE: IntellijIdea
build.gradlefile in which you imported the other script file?