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](upload://6h70GPkddqvuU6qqHYY94XKkSxy.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 https://github.com/cy6erGn0m/html4k.
I see, thanks! I will try to imitate your setup.
But why do you have these lines in the topmost pom?
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
</build>
It is really not my project (author: https://github.com/cy6erGn0m).
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.