I made this simple project: https://github.com/eje211/scalajswithlift
I tried to create a JSON object with Lift DSL and print it in the HTML console with Scala.js . But I get this error:
[info] Compiling 1 Scala source to /Users/eeytan/src/scalajs/target/scala-2.11/classes...
[info] Fast optimizing /Users/eeytan/src/scalajs/target/scala-2.11/scala-js-tutorial-fastopt.js
[error] Referring to non-existent class Lnet_liftweb_json_JsonDSL$
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent class Lnet_liftweb_json_package$
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent class Lnet_liftweb_json_JsonAST$
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent method Lnet_liftweb_json_JsonAST$.render__Lnet_liftweb_json_JsonAST$JValue__s_text_Document
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent method Lnet_liftweb_json_JsonDSL$.int2jvalue__I__Lnet_liftweb_json_JsonAST$JInt
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent method Lnet_liftweb_json_JsonDSL$.pair2Assoc__T2__F1__Lnet_liftweb_json_JsonDSL$JsonAssoc
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent method Lnet_liftweb_json_JsonDSL$.string2jvalue__T__Lnet_liftweb_json_JsonAST$JString
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[error] Referring to non-existent method Lnet_liftweb_json_package$.pretty__s_text_Document__T
[error] called from Ltutorial_webapp_TutorialApp$.main__V
[error] called from sjs_js_JSApp$class.$$js$exported$meth$main__sjs_js_JSApp__O
[error] called from Ltutorial_webapp_TutorialApp$.$$js$exported$meth$main__O
[error] called from Ltutorial_webapp_TutorialApp$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] Ltutorial_webapp_TutorialApp$
[trace] Stack trace suppressed: run last compile:fastOptJS for the full output.
[error] (compile:fastOptJS) There were linking errors
[error] Total time: 1 s, completed Oct 30, 2015 5:21:03 PM
I don't understand why.
If I remove the comment from build.sbt
, I get this error:
> ~fastOptJS
[trace] Stack trace suppressed: run last compile:scalaJSPreLinkClasspath for the full output.
[error] (compile:scalaJSPreLinkClasspath) org.scalajs.core.tools.classpath.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Ambiguous reference to a JS library: jquery.js
[error] Possible paths found on the classpath:
[error] - scala/tools/nsc/doc/html/resource/lib/jquery.js
[error] - META-INF/resources/webjars/jquery/2.1.3/jquery.js
[error] originating from: scalajs:compile
[error] Total time: 1 s, completed Oct 30, 2015 5:35:09 PM
I don't understand what's going on. Can't I use the Lift JSON DSL in Scala.js?