Migrating from Gradle using Groovy script to Kotlin script
suggest changeSteps:
- clone the gradle-script-kotlin project
- copy/paste from the cloned project to your project:
build.gradle.ktsgradlewgradlew.batsettings.gradle- update
build.gradle.ktsfor your needs. The scripts in the project you just cloned, or in one of its samples, can serve as a starting point - open the project in IntelliJ. In the explorer window it should be recognized as a Gradle project; if not, expand it first
- after opening, let IntelliJ finish syncing, open
build.gradle.kts, and check for errors. If highlighting is not working or everything is marked red, close and reopen IntelliJ - open the Gradle window and refresh it
If you are on Windows, you may encounter this bug. Download the full Gradle 3.3 distribution and use that instead of the one provided.
macOS and Ubuntu work out of the box.
As a small bonus, if you want to avoid publishing to Maven and similar repositories, use JitPack. The lines to add are almost identical to Groovy. You can take inspiration from this project.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents