Why can’t I use val inside Plugins {}?

Why can’t I use val inside Plugins {}?


val kotlinVersion = "1.3.72" plugins { // Error: 'val kotlinVersion: String' can't be called in this context by implicit receiver. Use the explicit one if necessary kotlin("jvm").version(kotlinVersion)] }

I use Kotlin’s standard library as a dependency too and I only want to have to specify the version in one place but when I try something like I did above in my build.gradle.kts I get that error you see in the comment. How do I resolve this?

submitted by /u/SmushyTaco
[link] [comments]