I have ScalaJS multi project where I try to include and use log4javascript from org.webjars.
Client part of the build.sbt is here:
lazy val mwlclient = (project in file("client")).
settings(commonSettings: _*).
settings(
persistLauncher := true,
persistLauncher in Test := false,
sourceMapsDirectories += mwlsharedJs.base / "..",
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "scalatags" % "0.5.2" withJavadoc(),
"be.doeraene" %%% "scalajs-jquery" % "0.8.0" withJavadoc(),
"com.lihaoyi" %%% "upickle" % "0.3.6" withJavadoc(),
"com.lihaoyi" %%% "autowire" % "0.2.5" withJavadoc(),
"org.scala-js" %%% "scalajs-dom" % "0.8.1" withJavadoc(),
// Javascript libs
"org.webjars" % "jquery" % "1.10.2",
"org.webjars" % "jquery-ui" % "1.11.4",
"org.webjars" % "log4javascript" % "1.4.13",
"com.lihaoyi" %%% "utest" % "0.3.0" % "test"
),
jsDependencies += RuntimeDOM,
jsDependencies += ProvidedJS / "urianchor-1.3.3/jquery.uriAnchor.js",
jsDependencies += "org.webjars" % "jquery" % "1.10.2" / "jquery.js",
jsDependencies += "org.webjars" % "jquery-ui" % "1.11.4" / "jquery-ui.js",
jsDependencies += "org.webjars" % "log4javascript" % "1.4.13" / "log4javascript.js",
testFrameworks += new TestFramework("utest.runner.Framework"),
scalaJSStage in Global := FastOptStage,
skip in packageJSDependencies := false
).enablePlugins(ScalaJSPlugin, ScalaJSPlay).
dependsOn(mwlsharedJs)
When I run sbt package, I get following error message:
[trace] Stack trace suppressed: run last mwlclient/compile:scalaJSPreLinkClasspath for the full output.
[error] (mwlclient/compile:scalaJSPreLinkClasspath) org.scalajs.core.tools.classpath.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Ambiguous reference to a JS library: log4javascript.js
[error] Possible paths found on the classpath:
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/log4javascript.js
[error] originating from: mwlclient:compile
[error] Total time: 17 s, completed Jan 13, 2016 11:02:30 AM
[mwlserver] $
^M[mwlserver] $
[mwlserver] $ last mwlclient/compile:scalaJSPreLinkClasspath
org.scalajs.core.tools.classpath.JSLibResolveException: Some references to JS libraries could not be resolved:
- Ambiguous reference to a JS library: log4javascript.js
Possible paths found on the classpath:
- META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript.js
- META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript.js
- META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript.js
- META-INF/resources/webjars/log4javascript/1.4.13/log4javascript.js
originating from: mwlclient:compile
at org.scalajs.core.tools.classpath.PartialClasspath.resolveAllResourceNames(PartialClasspath.scala:137)
at org.scalajs.core.tools.classpath.PartialClasspath.resolveDependencies(PartialClasspath.scala:80)
at org.scalajs.core.tools.classpath.PartialClasspath.resolve(PartialClasspath.scala:64)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$16.apply(ScalaJSPluginInternal.scala:220)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$16.apply(ScalaJSPluginInternal.scala:217)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (mwlclient/compile:scalaJSPreLinkClasspath) org.scalajs.core.tools.classpath.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Ambiguous reference to a JS library: log4javascript.js
[error] Possible paths found on the classpath:
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript.js
[error] - META-INF/resources/webjars/log4javascript/1.4.13/log4javascript.js
[error] originating from: mwlclient:compile
Webjars says log4javascript contains following files:
META-INF/resources/webjars/log4javascript/1.4.13/changelog.txt
META-INF/resources/webjars/log4javascript/1.4.13/console.html
META-INF/resources/webjars/log4javascript/1.4.13/console_uncompressed.html
META-INF/resources/webjars/log4javascript/1.4.13/js/console.html
META-INF/resources/webjars/log4javascript/1.4.13/js/console_uncompressed.html
META-INF/resources/webjars/log4javascript/1.4.13/js/liteconsole.html
META-INF/resources/webjars/log4javascript/1.4.13/js/liteconsole_uncompressed.html
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript.js
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript_lite.js
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript_lite_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript_production.js
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript_production_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/log4javascript_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript_lite.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript_lite_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript_production.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript_production_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/stubs/log4javascript_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript_lite.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript_lite_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript_production.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript_production_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/js/tests/log4javascript_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/license.txt
META-INF/resources/webjars/log4javascript/1.4.13/log4javascript.js
META-INF/resources/webjars/log4javascript/1.4.13/log4javascript_uncompressed.js
META-INF/resources/webjars/log4javascript/1.4.13/main.css
How can I change the build.sbt so that sbt finds the correct log4javascript.js?
Use:
jsDependencies += "org.webjars" % "log4javascript" % "1.4.13" / "1.4.13/log4javascript.js",
so that the path of log4javascript.js is more specific, and the other 3 alternatives found in the classpath are not selected.
Related
Whose problem is this and how does it get (re)solved?
My build.sbt works fine in Scala 2.12.12
My SBT is version 1.4.4
scalaVersion := "2.12.12"
If however I attempt to update Scala to 2.13.4 (or 2.13.0)
scalaVersion := "2.13.4"
Then I get this in the sbt console:
[warn]
[warn] Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.scala-sbt:scripted-plugin_2.13:1.4.4
[error] Not found
[error] Not found
[error] not found: https://repo1.maven.org/maven2/org/scala-sbt/scripted-plugin_2.13/1.4.4/scripted-plugin_2.13-1.4.4.pom
[error] not found: /Users/garyhewett/.ivy2/local/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
[error] at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:258)
[error] at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:227)
[error] at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:227)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:53)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:103)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:73)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:116)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:228)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:116)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:97)
[error] at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:130)
[error] at sbt.Classpaths$.$anonfun$updateTask0$5(Defaults.scala:3485)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:829)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.scala-sbt:scripted-plugin_2.13:1.4.4
[error] Not found
[error] Not found
[error] not found: https://repo1.maven.org/maven2/org/scala-sbt/scripted-plugin_2.13/1.4.4/scripted-plugin_2.13-1.4.4.pom
[error] not found: /Users/garyhewett/.ivy2/local/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
[error] not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
[error] not found: https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin_2.13/1.4.4/ivys/ivy.xml
I'm documenting the question here as I can not seem to find any references to it at all (yet) but given that there have been at least 4 upgrades in Scala 2.13 then there must be something I'm missing.
I'm using this in the libraryDependencies:
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value,
and I think (but am not sure) I would be happy to turn "scripted" off but do not seem to be able to do so. Yes I checked the project/plugins (not there) and build.properties (not there either)
Attempts tp "turn off" scripted result in this output:
References to undefined settings:
scriptedLaunchOpts from scripted ((sbt.ScriptedPlugin.projectSettings) ScriptedPlugin.scala:99)
scriptedBufferLog from scripted ((sbt.ScriptedPlugin.projectSettings) ScriptedPlugin.scala:99)
Did you mean Test / g8 / scriptedBufferLog ?
scriptedLaunchOpts from Test / g8Test ((giter8.Giter8Plugin.giter8TestSettings) Giter8Plugin.scala:102)
scriptedBufferLog from Test / g8Test ((giter8.Giter8Plugin.giter8TestSettings) Giter8Plugin.scala:102)
Did you mean Test / g8 / scriptedBufferLog ?
I have this for the resolvers:
resolvers += Resolver.url("typesafe", url("https://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.ivyStylePatterns),
/project/build.sbt
sbt.version=1.4.4
/project.giter8.sbt
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8" % "0.11.0")
/project/plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0") // 2020-Sep-29 -- https://github.com/sbt/sbt-assembly/releases
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.0") // 2020-Apr-03 -- https://index.scala-lang.org/playframework/twirl/twirl-api
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") // 2020-May-15 -- https://github.com/sbt/sbt-git
build.sbt
sbtPlugin := true
scalaVersion := "2.12.12" // 2020-09-29 https://scala-lang.org/download/all.html
lazy val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.2" // 2020-09-29 -- https://github.com/typelevel/scalacheck/blob/master/RELEASE.markdown
parallelExecution in Test := false
lazy val lambda = (project in file("."))
.settings(
scriptedLaunchOpts ++= List("-Xms1024m", "-Xmx1024m", "-XX:ReservedCodeCacheSize=128m", "-XX:MaxPermSize=256m", "-Xss2m", "-Dfile.encoding=UTF-8"),
resolvers += Resolver.url("typesafe", url("https://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.ivyStylePatterns),
libraryDependencies ++= Seq(
scalacheck % Test,
"com.github.bigwheel" %% "util-backports" % "2.1", // 2020-Dec-11 -- https://index.scala-lang.org/bigwheel/util-backports/util-backports/1.1?target=_2.12
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value, // 2020-Dec-08 -- https://github.com/sbt/sbt/issues/3514
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.11.903", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dynamodb
"com.amazonaws" % "aws-java-sdk-kms" % "1.11.903", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-kms
"com.amazonaws" % "aws-java-sdk-lambda" % "1.11.903", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-lambda
"com.amazonaws" % "aws-java-sdk-rdsdata" % "1.11.903", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-rdsdata
"com.amazonaws" % "aws-java-sdk-s3" % "1.11.903", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3
"com.amazonaws" % "aws-lambda-java-core" % "1.2.1", // 2020-Apr-29 -- https://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-core
"com.amazonaws" % "aws-lambda-java-events" % "3.6.0", // 2020-Nov-18 -- https://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-events
"com.sun.mail" % "jakarta.mail" % "1.6.5", // 2020-Jun-10 -- https://eclipse-ee4j.github.io/mail/ https://mvnrepository.com/artifact/com.sun.mail/smtp Latest is 1.6.5 however only 1.6.2 will load
"com.typesafe" % "config" % "1.4.0", // 2020-Mar-27 -- https://github.com/lightbend/config
"com.twilio.sdk" % "twilio" % "8.2.0", // 2020-Nov-18 -- https://www.twilio.com/docs/libraries/java#using-with-a-build-automation-tool
"com.authy" % "authy-java" % "1.5.0", // 2020-Aug-13 -- https://github.com/twilio/authy-java
"org.mariadb.jdbc" % "mariadb-java-client" % "2.7.0", // 2020-Sep-29 -- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
"mysql" % "mysql-connector-java" % "8.0.22", // 2020-Nov-18 -- https://mvnrepository.com/artifact/mysql/mysql-connector-java
"com.typesafe.play" %% "play-json" % "2.9.1", // 2020-Sep-29 -- https://mvnrepository.com/artifact/com.typesafe.play/play-json
"com.github.cb372" %% "scalacache-caffeine" % "0.28.0", // 2020-May-15 -- https://cb372.github.io/scalacache/docs/cache-implementations.html
"org.slf4j" % "slf4j-nop" % "1.7.21" // 202-May-19 -- https://github.com/sbt/sbt-git (just turns off error by loading a NOOP class)
)
)
.enablePlugins(SbtTwirl) // 2020-Apr-03 -- https://index.scala-lang.org/playframework/twirl/twirl-api
.enablePlugins(GitVersioning) // 2020-May-15 -- https://github.com/sbt/sbt-git
.enablePlugins(GitBranchPrompt) // 2020-May-15 -- https://github.com/sbt/sbt-git
.enablePlugins(ScriptedPlugin)
I can not seem to find any reference to scripted-plugin_2.13 in maven which leads me to think this is most likely a configuration error on my part?
To be clear my final goal is simply to update the Scala version to 2.13.4
I am trying to follow the ScalaJS Book tutorial. Based on their build.sbt sample here https://github.com/ochrons/scalajs-spa-tutorial/blob/master/build.sbt
I have created the following build.sbt
lazy val client = (project in file("client"))
.settings(
name := "client",
version := "1.0.0",
scalaVersion := "2.12.4",
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.4",
"com.lihaoyi" %%% "scalatags" % "0.6.7",
"com.vmunier" %% "scalajs-scripts" % "1.1.1",
"org.webjars" % "font-awesome" % "5.0.6" % Provided,
"org.webjars" % "bootstrap" % "4.0.0" % Provided,
"com.lihaoyi" %% "utest" % "0.6.3" % Test
),
jsDependencies ++= Seq(
"org.webjars.bower" % "react" % "16.1.0" / "react-with-addons.js" minified "react-with-addons.min.js" commonJSName "React",
"org.webjars.bower" % "react" % "16.1.0" / "react-dom.js" minified "react-dom.min.js" dependsOn "react-with-addons.js" commonJSName "ReactDOM",
"org.webjars" % "jquery" % "3.3.1" / "jquery.js" minified "jquery.min.js",
"org.webjars" % "bootstrap" % "4.0.0" / "bootstrap.js" minified "bootstrap.min.js" dependsOn "jquery.js",
"org.webjars" % "chartjs" % "2.7.0" / "Chart.js" minified "Chart.min.js",
"org.webjars" % "log4javascript" % "1.4.13" / "js/log4javascript_uncompressed.js" minified "js/log4javascript.js"
),
skip in packageJSDependencies := false,
scalaJSUseMainModuleInitializer := true,
scalaJSUseMainModuleInitializer in Test := false,
testFrameworks += new TestFramework("utest.runner.Framework")
).enablePlugins(ScalaJSPlugin).dependsOn(SharedJS)
But when I do sbt ~fastOptJS I get an error
[error] org.scalajs.core.tools.jsdep.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Missing JS library: react-dom.js
[error] originating from: client:compile
[error] - Missing JS library: react-with-addons.js
[error] originating from: client:compile
[error]
[error] at org.scalajs.core.tools.jsdep.DependencyResolver$.resolveAllResourceNames(DependencyResolver.scala:84)
[error] at org.scalajs.core.tools.jsdep.DependencyResolver$.resolveDependencies(DependencyResolver.scala:25)
[error] at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSConfigSettings$46(ScalaJSPluginInternal.scala:671)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (client / Compile / resolvedJSDependencies) org.scalajs.core.tools.jsdep.JSLibResolveException: Some referencesto JS libraries could not be resolved:
[error] - Missing JS library: react-dom.js
[error] originating from: client:compile
[error] - Missing JS library: react-with-addons.js
[error] originating from: client:compile
[error] Total time: 3 s, completed Feb 10, 2018 9:02:20 PM
Take a look at:
https://github.com/reactjs/react-bower
there is no
react-with-addons.js
package ...
There are other projects like https://scalacenter.github.io/scalajs-bundler/getting-started.html
besides you can manually include external JS sources via cdn:
https://reactjs.org/docs/cdn-links.html
I am using CDH cluster with Spark 2.1 with Scala 2.11.8.
I use sbt 1.0.2.
While doing assembly, I am getting error as
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-parser-combinators
I tried to override the version mismatch using dependencyOverrides and force(), but neither worked.
Error message from sbt assembly
[error] Modules were resolved with conflicting cross-version suffixes in {file:/D:/Tools/scala_ide/test_workspace/test/NewSp
arkTest/}newsparktest:
[error] org.scala-lang.modules:scala-xml _2.11, _2.12
[error] org.scala-lang.modules:scala-parser-combinators _2.11, _2.12
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.
modules:scala-parser-combinators
[error] at scala.sys.package$.error(package.scala:27)
[error] at sbt.librarymanagement.ConflictWarning$.processCrossVersioned(ConflictWarning.scala:39)
[error] at sbt.librarymanagement.ConflictWarning$.apply(ConflictWarning.scala:19)
[error] at sbt.Classpaths$.$anonfun$ivyBaseSettings$64(Defaults.scala:1971)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (*:update) Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-par
ser-combinators
[error] Total time: 413 s, completed Oct 12, 2017 3:28:02 AM
build.sbt
name := "newtest"
version := "0.0.2"
scalaVersion := "2.11.8"
sbtPlugin := true
val sparkVersion = "2.1.0"
mainClass in (Compile, run) := Some("com.testpackage.sq.newsparktest")
assemblyJarName in assembly := "newtest.jar"
libraryDependencies ++= Seq(
"org.apache.spark" % "spark-core_2.11" % "2.1.0" % "provided",
"org.apache.spark" % "spark-sql_2.11" % "2.1.0" % "provided",
"com.databricks" % "spark-avro_2.11" % "3.2.0",
"org.apache.spark" % "spark-hive_2.11" % "2.1.0" % "provided")
libraryDependencies +=
"log4j" % "log4j" % "1.2.15" excludeAll(
ExclusionRule(organization = "com.sun.jdmk"),
ExclusionRule(organization = "com.sun.jmx"),
ExclusionRule(organization = "javax.jms")
)
resolvers += "SparkPackages" at "https://dl.bintray.com/spark-packages/maven/"
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs # _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
plugins.sbt
dependencyOverrides += ("org.scala-lang.modules" % "scala-xml_2.11" % "1.0.4")
dependencyOverrides += ("org.scala-lang.modules" % "scala-parser-combinators_2.11" % "1.0.4")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
resolvers += Resolver.url("bintray-sbt-plugins", url("https://dl.bintray.com/eed3si9n/sbt-plugins/"))(Resolver.ivyStylePatterns)
tl;dr Remove sbtPlugin := true from build.sbt (that is for sbt plugins not applications).
You should also remove dependencyOverrides from plugins.sbt.
You should change spark-core_2.11 and the other Spark dependencies in libraryDependencies to be as follows:
libraryDependencies += "org.apache.spark" %% "spark-core" % "2.1.0" % "provided"
The change is to use %% (= two percent signs) and remove the version of Scala from the middle part of a dependency, e.g. spark-core above.
I'm using Fedora Linux and sbt. I think I've tried everything, but I can't persuade sbt to use Scala 2.12.2 to compile my project.
When I compile the same project with:
Gradle,
IntelliJ IDEA,
SBT on a different Linux distro,
everything works. I just can't get it to work on Fedora Linux and sbt.
Here's my build.sbt:
scalaVersion := "2.12.2"
scalaVersion in ThisBuild := "2.12.2"
crossScalaVersions := Seq(scalaVersion.value)
scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-language:postfixOps")
libraryDependencies ++= Seq("org.xerial" % "sqlite-jdbc" % "3.18.0",
"org.apache.httpcomponents" % "httpclient" % "4.5.3",
"commons-codec" % "commons-codec" % "1.10",
"commons-cli" % "commons-cli" % "1.4",
"org.hjson" % "hjson" % "1.0.0",
"log4j" % "log4j" % "1.2.17",
"org.zeromq" % "jeromq" % "0.4.0",
"com.nimbusds" % "nimbus-jose-jwt" % "4.23",
"ws.wamp.jawampa" % "jawampa-core" % "0.5.0",
"ws.wamp.jawampa" % "jawampa-netty" % "0.5.0",
"org.glassfish.tyrus" % "tyrus-websocket-core" % "1.2.1",
"org.glassfish.tyrus.bundles" % "tyrus-standalone-client" % "1.13.1",
"org.scalactic" %% "scalactic" % "3.0.1",
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
"org.postgresql" % "postgresql" % "42.1.1")
// https://mvnrepository.com/artifact/org.apache.commons/commons-compress
libraryDependencies += "org.apache.commons" % "commons-compress" % "1.14"
// https://mvnrepository.com/artifact/org.tukaani/xz
libraryDependencies += "org.tukaani" % "xz" % "1.6"
// https://mvnrepository.com/artifact/net.sourceforge.htmlunit/htmlunit
libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.27"
Here's my project/build.properties:
sbt.version=0.13.15
scala.version=2.12.2
build.scala.version=2.12.2
def.scala.versions=2.12.2
Every time I start sbt and try to compile, I'm getting some syntax errors (I've changed some strings to xxx, sorry):
[info] Compiling 76 Scala sources to /home/antek/dev/scala/xxx/target/scala-2.12/classes...
[error] /home/antek/dev/scala/xxx/src/main/scala/api/xxx.scala:168: macros cannot be partially applied
[error] httpPost(transApi, args + ("xxx" → f"$currentTime%d"), "API-Key", "API-Hash")
[error] ^
[error] /home/antek/dev/scala/xxx/src/main/scala/api/xxx.scala:39: macros cannot be partially applied
[error] httpPost(transApi, args + ("xxx" → f"$currentTime%d"), "API-Key", "API-Hash")
[error] ^
[error] /home/antek/dev/scala/xxx/src/main/scala/api/HttpSignOperation.scala:51: macros cannot be partially applied
[error] Log.put(f"HTTP GET returned status $status%d")
[error] ^
[error] /home/antek/dev/scala/xxx/src/main/scala/api/HttpSignOperation.scala:82: macros cannot be partially applied
[error] Log.put(f"HTTP POST returned status $status%d")
[error] ^
[error] /home/antek/dev/scala/xxx/src/main/scala/api/JWSOperation.scala:38: macros cannot be partially applied
[error] Log.put(f"HTTP POST returned status $status%d")
[error] ^
[error]
[error] while compiling: /home/antek/dev/scala/xxx/src/main/scala/api/Order.scala
[error] during phase: typer
[error] library version: version 2.10.4
[error] compiler version: version 2.10.4
[error] reconstructed args: -classpath /home/antek/dev/scala/xxx/target/scala-2.12/classes:/home/antek/.ivy2/cache/org.xer[... cut ...]64/jre/classes:/home/antek/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.2.jar
I'm quite new to Scala, Akka and SBT, so this issue is giving me some headache! I'm working with the book Akka in Action, where the author provides examples on Github:
https://github.com/RayRoestenburg/akka-in-action
On a clean clone of the repository, i was trying to have a look at the example in chapter-cluster.
As described in the book, the first thing to do is to start a seed node on the local machine with:
sbt -DHOST=127.0.0.1 -DPORT=2551
I was trying to install another Scala version, run it with root privileges, but without success. In my understanding SBT should take care of all the versioning stuff and download the specified packages.
Error messages goes like that:
[info] Loading global plugins from /home/sfink/.sbt/0.13/plugins
[info] Loading project definition from /home/sfink/IdeaProjects/akka-in-action/chapter-cluster/project
[info] Updating {file:/home/sfink/IdeaProjects/akka-in-action/chapter-cluster/project/}chapter-cluster-build...
[info] Resolving org.scala-sbt#compiler-interface;0.13.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[warn] :: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
unresolved dependency: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:213)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:104)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:51)
at sbt.IvySbt$$anon$3.call(Ivy.scala:60)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.withFileLock(Locks.scala:102)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
at xsbt.boot.Locks$.apply0(Locks.scala:38)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:60)
at sbt.IvySbt.withIvy(Ivy.scala:101)
at sbt.IvySbt.withIvy(Ivy.scala:97)
at sbt.IvySbt$Module.withModule(Ivy.scala:116)
at sbt.IvyActions$.update(IvyActions.scala:121)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1161)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1159)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1182)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1180)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1184)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1179)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1187)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1152)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1130)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[error] unresolved dependency: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
Update 1:
This is the content of the build.sbt file:
name := "words-cluster"
version := "1.0"
scalaVersion := "2.11.7"
organization := "com.manning"
libraryDependencies ++= {
val akkaVersion = "2.4.14"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.0.10"
)
}
// Assembly settings
mainClass in Global := Some("aia.cluster.words.Main")
assemblyJarName in assembly := "words-node.jar"
Any idea what is going wrong?
Try this as your build.sbt:
name := "words-cluster"
version := "1.0"
scalaVersion := "2.11.8"
organization := "com.manning"
libraryDependencies ++= {
val akkaVersion = "2.4.14"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"org.scalatest" %% "scalatest" % "3.0.1" % "test" exclude("org.scala-lang.modules", "scala-xml_2.11"),
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.1.7"
)
}
// Assembly settings
mainClass in Global := Some("aia.cluster.words.Main")
assemblyJarName in assembly := "words-node.jar"
I updated the scala, logging and scalatest versions
Seems like the sbt version i was using was the wrong one! After upgrading to sbt-0.13.15 compilation was running properly.
Thanks for helping!