Kotlin / kotlin-frontend-plugin

Gradle Kotlin (http://kotlinlang.org) plugin for frontend development
Apache License 2.0
561 stars 69 forks source link

Extension with name 'kotlin' does not exist #146

Closed steelxt closed 5 years ago

steelxt commented 5 years ago

despite #142 warn about must include kotlin plugin first I'm getting:

Extension with name 'kotlin' does not exist. Currently registered extension names: [ext, defaultArtifacts, reporting, sourceSets, java]

yes I have settings setup :

`pluginManagement {

repositories {
    gradlePluginPortal()
    maven { setUrl("https://jcenter.bintray.com/") }
    maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }    }

resolutionStrategy {
    eachPlugin {
        println "req id =  $requested.id.id"
        println "req id =  $requested.version"

        if (requested.id.id == "kotlin2js") {

            useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
        }
        if( requested.id.id == 'org.jetbrains.kotlin.frontend') {
            useModule("org.jetbrains.kotlin:kotlin-frontend-plugin:${requested.version}")
        }
    }
}

}`

but I'm using build.gradle.kts in my sub project:

plugins { id("kotlin2js") id("org.jetbrains.kotlin.frontend") version "0.0.45" }

without no luck, can you help and guide my to right direction?

Lewik commented 5 years ago

+1

steelxt commented 5 years ago

Solved. I was applying some plugins in gradle.build.kts parent, It seems to be working only applying local build files with.

Lewik commented 5 years ago

In addition, check order of plugins

https://stackoverflow.com/questions/42158019/extension-with-name-android-does-not-exist-error-when-adding-kotlin-to-andro

my config was (and it fails)

apply plugin: 'org.jetbrains.kotlin.frontend'
apply plugin: 'kotlin-platform-js'
apply plugin: 'kotlinx-serialization'

Order below works

apply plugin: 'kotlin-platform-js'
apply plugin: 'kotlinx-serialization'
apply plugin: 'org.jetbrains.kotlin.frontend'