Kotlin with gradle will not configure in Intellij

I have a multi module gradle project in Idea. All modules are kotlin 1.1.1, but one targets JS using 1.1.2. The project builds from command line fine. However Idea reports the error above source files in the editor “Kotlin not configured”. Idea does not index any of my classes so I’m not getting any of the normal Idea features like “Go to Declaration” which does nothing.

My Idea project appears to be correctly configured to use Kotlin targeting JS, correctly importing these settings from gradle. But they aren’t actually propagating into Idea.

When I run a gradle task from the gradle panel, the Run panel reports error “Configure settings”. There are no details on what is not configured.

I’m using:
Gradle plugin version 171.4249.39
Kotlin plugin version 1.1.2-release-IJ2017.1-2
IntelliJ IDEA 2017.1.2 Build #IU-171.4249.39, built on April 25, 2017
On Mac OS X 10.12.4

I don’t know how to fix this. It’s really unhelpful as far as telling me what is not configured.

This seems to be a bug with gradle plugin. In my build.gradle for the kotlin JS subproject, I have defined a task that has a dependency on an html file. This causes IntelliJ to throw some kind of exception that then prevents Kotlin finishing being configured. I’m still seeing the yellow warning “Kotlin is not configured” above the editor. However the source sets are now indexed by Idea.
I wasted many hours trying to understand this :frowning:

I can still

Here’s part of my build.gradle that causes the problem. Using an html file in the files() method causes intellij to break:

task copyJsResources(dependsOn:build){
    dependencies{
        build
        runtime files(resourcesDir)//, '${resourcesDir}/index.html') // THIS IS CAUSING THE ISSUES
    }
    doLast {
        copy {
            from 'resourcesDir'
            into "${buildOutDir}"
            exclude {details -> details.isDirectory()}
            eachFile { println ("Copying resource for build: ${it.file}" )}
        }
        //copy kotlin.js into lib folder
        configurations.compile.each { File file ->
            copy {
                includeEmptyDirs = false
                from zipTree(file.absolutePath)
                into "${buildOutDir}/lib"
                include { fileTreeElement ->
                    def path = fileTreeElement.path
                    path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
                }
            }
        }

        println("Copied kotlin.js from jar")
        println("Finished copying resources into build folder...")
    }


}

tasks.build.doLast() {
    tasks.copyJsResources.execute()
    println("Finished build!")
}

Can you please file a YouTrack issue and post the stacktrace of the exception? Thanks!