Java dependencies "not a valid Kotlin Javascript library"


I had an existing web module which I added support for Kotlin (Javascript). I choose copy libraries and I got this: /uploads/kotlinlang/original/1X/2bfc44650ad7d2647afec9a9b4554af06192c258.png

However when I compile I get this error:
Error:Kotlin: ‘/Users/joerunds/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar’ is not a valid Kotlin Javascript library

commons-lang is the first 3rd-party dependency in the list of dependencies.

What am I doing wrong?


For now, each dependency for kotlin/javascript module should be a valid Kotlin Javascript library, e.g., contains some js-files with metadata (like kotlin-jslib.jar).

There is an example with different submodules for js and jvm in one project, see


I see, thanks! I will try to imitate your setup.

But why do you have these lines in the topmost pom?

  <sourceDirectory>{project.basedir}/src/main/kotlin&lt;/sourceDirectory&gt; &nbsp;&nbsp;&lt;testSourceDirectory&gt;{project.basedir}/src/test/kotlin</testSourceDirectory>


It is really not my project (author:

About the mentioned lines in the topmost pom: it seems you can set these values independently in every sub-project, and the result will be the same.


OK. I see. It would be helpful if JetBrains could provide more project examples on using maven (especially for Kotlin javascript). It would then be easier for newcomers to get something running.

For example, I’m struggling to know what’s actually required to be included in the final war.


I managed to get around this by moving my Kotlin code a separate Maven module and ensure that it has no Java dependencies or inherits any from parent module.