问题
I have a cross building scala-js project with a client, server and shared folder. If I add a lib folder with some jars in the server project folder I can reference the classes in the jars in my server code. But if add the lib folder in the shared project folder I can't reference the classes in my shared code. Can I add some command in my sbt build file to get my jars visible in my shared project or what should I do?
回答1:
.jars should never be shared, since it is not the same .jar for Scala/JVM and Scala.js, even if they have the same source code.
If you have the two .jars for JVM and JS, you can put them in shared/jvm/lib/ and shared/js/lib/, respectively.
(if you use .crossType(CrossType.Pure), use .jvm/.js instead of jvm/js)
来源:https://stackoverflow.com/questions/46744383/how-to-add-lib-with-jars-to-shared-folder