https://kotlinlang.org logo
Title
h

hellman

11/09/2019, 4:05 PM
I got this at the moment, but that doesn’t work:
plugins {
    id("org.jetbrains.kotlin.js") version "1.3.60-eap-76"
}

repositories {
    mavenCentral()
    mavenLocal()
    maven(url = "<https://dl.bintray.com/kotlin/kotlin-eap>")
}
o

oskarh

11/09/2019, 9:13 PM
I haven’t tried out EAP myself but according to the pinned message in #eap you can follow the instructions at https://discuss.kotlinlang.org/t/kotlin-1-3-60-early-access-preview/14579
👍 1
h

hellman

11/10/2019, 11:14 AM
Can’t get it to work with a Kotlin gradle script. 😕
It works if I use regular gradle script,
o

oskarh

11/10/2019, 12:43 PM
Don’t have much experience with kotlin gradle scipting either I’m afraid. Maybe someone in #gradle can help you out?
m

Mike

11/10/2019, 1:56 PM
Plugins don't use the same repositories as the one listed there. It's a bit confusing at first. The Build script has it's dependencies/configuration, and your actual build has its. In settings.gradle, add
pluginManagement {
    repositories {
        maven(url = "<https://dl.bintray.com/kotlin/kotlin-eap>")
    }
}
Although that's acceptable for Groovy so may have to tweak a bit for Kotlin DSL.
It was clearer when they used the
buildscript
block, but also more clutter in your main build file.
h

hellman

11/10/2019, 2:16 PM
wait, so with Kotlin Gradle script you don’t use
buildscript
anymore?
Also, why settings.gradle? Why can’t I put that in build.gradle.kts?
m

Mike

11/10/2019, 2:55 PM
No, it's not Kotlin Gradle that changed this. You have 2 ways to bring plugins into your build. Either with buildscript OR using the
plugins
block. The
plugins
block is the recommended approach now. It can speed up build configuration phase BUT does have some syntax restrictions as a result. Won't go into details here. If you use buildscript, then everything is in the build.gradle file. If you use
plugins
, then plugin configuration goes into the settings file.
If you go to the end of the
Limitations of the plugins DSL
section, you'll see this
If the restrictions of the plugins {} block are prohibitive, the recommended approach is to apply plugins using the buildscript {} block
👍 1