June 2017
Intermediate to advanced
400 pages
8h 44m
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.
Note that src/main/kotlin is already specified by default, but you would use the sourceSets { } block to specify a different directory if needed:
apply plugin: "kotlin" sourceSets { main.kotlin.srcDirs += 'src/main/kotlin' }
Read now
Unlock full access