Multiplatform + war?

Hi,

Anyone have any luck packaging a multiplatform (jvm + js) project into a war for Tomcat, etc. If I simply apply the war plugin, the two plugins do not play well together.

Rob

Here’s my attempt at a task, and the gradle error, which I don’t understand…

A problem occurred configuring root project 'MyProject'.
 > Failed to notify project evaluation listener.
     > Cannot change dependencies of configuration ':jsApi' after it has been included in dependency resolution.
     > Cannot change artifacts of configuration ':jsRuntime' after it has been included in dependency resolution.

Gradle task:

task war(type: Jar) {
    dependsOn jvmMainClasses, jsMainClasses

    archiveBaseName = "myapp"
    archiveExtension = "war"

    def jsComps = kotlin.targets.js.compilations
    def jvmComps = kotlin.targets.jvm.compilations

    from(jvmComps.main.output.allOutputs.files) {
        into("WEB-INF/classes")
    }
    from(jvmComps.main.compileDependencyFiles) {
        into("WEB-INF/lib")
    }
    from("src/webapp")       
    into('static') {
        from(jsComps.main.output) {
            exclude "*.scss"
        }                       
        jsComps.main.runtimeDependencyFiles.each { // ← problem
            from zipTree(it.absolutePath).matching {
                include '*.js'
            } 
        }
    }
}

YouTrack issue for reference: https://youtrack.jetbrains.com/issue/KT-31875