I tried to migrate one of my project to Gradle using a Kotlin script.
These are my steps:
- substituted the
/gradle/wrapper/gradle-wrapper.jar
with this one - updated the
distributionUrl
ofgradle/wrapper/gradle-wrapper.properties
to the same as here - created the corresponding
build.gradle.kts
- setting
settings.gradle
torootProject.buildFileName = 'build.gradle.kts'
At that point Intellij detects it and suggests:
You can configure Gradle wrapper to use distribution with sources. It will provide IDE with Gradle API/DSL documentation.
-> Ok, apply suggestion!
Gradle 'hello-kotlin' project refresh failed
Error:Plugin with id 'kotlin' not found.
Then I also tried to try one of the official samples:
- cloned the repo
- opened the sample
- same error
...what am I doing wrong?
I came back to the official sample, tried to invalidate cache and restart, it didn't work
I tried to remove
apply {
plugin("kotlin")
}
Refresh Gradle, add it again, refresh Gradle, it worked
If I open a src file, Intellij says:
Kotlin not configured
However the sample seems running now..
Intellij 2017.1 EAP
Kotlin 1.1m04
It seems working now, this is what I did:
in the project directory, I removed:
.gradle
.idea
build
gradle
gradlew
gradlew.bat
settings.gradle
I left only
src
and thebuild.gradle.kts
scriptcopy/paste from the
hello-kotlin
:gradle
gradlew
gradlew.bat
settings.gradle
open Intellij, chose "Open Project" and it was automatically showing up as a Gradle Project, selected and opened