Home > Software engineering >  Specify kotlin version in buildSrc kotlin convention plugin
Specify kotlin version in buildSrc kotlin convention plugin

Time:12-28

I am developing a Kotlin project with multiple subprojects as explained here
Building Kotlin Applications with libraries Sample (gradle.org)

Is it correct to specify the kotlin version as as shown below? file: buildSrc/build.gradle.kts

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:<kotlin-version>")
}

Also, is it possible to move this kotlin version to a central location for declaring project-wide dependency version (for example gradle.properties or buildSrc/**/Dependencies.kt or versions catalog)? None of the approaches mentioned seems to be supported in buildSrc/build.gradle.kts.

CodePudding user response:

I have solved this issue by specifying kotlinVersion in gradle.properties file as below.

kotlinVersion=1.6.10

Keep gradle.properties file at outermost project level.

CodePudding user response:

in app gradle implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" and project gradle ext.kotlin_version = "1.6.0"

  • Related