February 2020
Intermediate to advanced
412 pages
9h 36m
English
To use the Kotlin language with Gradle, first, add the following buildscript {} block to your build.gradle file:
buildscript { ext.kotlin_version = '<version to use>' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle- plugin:$kotlin_version" } }
Then, you will need to apply the plugin, as shown in the following code, as well as the directories that will hold the source code:
apply plugin: "kotlin"sourceSets { main.kotlin.srcDirs += 'src/main/kotlin'}
Note that src/main/kotlin is already specified by default, but you could use the sourceSets { } block to specify a different directory if needed.
Read now
Unlock full access