Some references to JS libraries could not be resolved - scala.js

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

Related

Alpakka and Akka Version Compatibility Issue

When I try to sbt build my project, the project build fails with an "extracting product structure failed" error. I am suspecting something related to the versions I am using for Alpakka and Akka.
Here is my build.sbt file:
lazy val akkaHttpVersion = "10.2.4" // "10.1.11"
lazy val akkaVersion = "2.6.14" // "2.5.31"
val JacksonVersion = "2.10.5.1"
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.example",
scalaVersion := "2.13.4"//"2.12.11"
)),
name := "XYZ",
libraryDependencies ++= Seq(
"org.orekit" % "orekit" % "10.3",
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.1.4" % Test,
"org.ehcache" % "ehcache" % "3.1.3",
"org.apache.httpcomponents" % "httpclient" % "4.5.13",
"org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0",
"org.apache.sling" % "sling-maven-plugin" % "2.4.2",
"com.fasterxml.jackson.module" % "jackson-module-scala" % "2.0.2",
"com.fasterxml.jackson.core" % "jackson-databind" % JacksonVersion,
"com.typesafe.akka" %% "akka-stream-kafka" % "2.0.7",
"com.lightbend.akka" %% "akka-stream-alpakka-reference" % "2.0.2"
)
)
When I remove the alpakka dependency at the end of the library, the error goes away but I am unable to to build project because of the missing alpakka dependency.
Ultimately, I am just trying to implement this: https://akka.io/alpakka-samples/http-csv-to-kafka/step4.html
Gael: Here is the image of the error message from Intellij
When running sbt clean compile, I get the following error stack:
[warn]
[warn] Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading com.lightbend.akka:akka-stream-alpakka-reference_2.13:2.0.2
[error] Not found
[error] Not found
[error] not found: C:\Users\ihussein\.ivy2\localcom.lightbend.akka\akka-stream-alpakka-reference_2.13\2.0.2\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/lightbend/akka/akka-stream-alpakka-reference_2.13/2.0.2/akka-stream-alpakka-reference_2.13-2.0.2.pom
[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:3486)
[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.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[error] at java.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[error] at java.lang.Thread.run(Unknown Source)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.lightbend.akka:akka-stream-alpakka-reference_2.13:2.0.2
[error] Not found
[error] Not found
[error] not found: C:\Users\ihussein\.ivy2\localcom.lightbend.akka\akka-stream-alpakka-reference_2.13\2.0.2\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/lightbend/akka/akka-stream-alpakka-reference_2.13/2.0.2/akka-stream-alpakka-reference_2.13-2.0.2.pom
It seems that I needed to use "com.lightbend.akka" %% "akka-stream-alpakka-csv" % "2.0.2" instead of "com.lightbend.akka" %% "akka-stream-alpakka-reference" % "2.0.2".

sbt.librarymanagement.ResolveException: Error downloading org.scala-sbt:scripted-plugin_2.13:1.4.4

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

Task "assembly" fails with "[error] (assembly) java.nio.file.InvalidPathException: Trailing char < > at index 121"

Executing the task "assembly" fails with [error] (assembly) java.nio.file.InvalidPathException: Trailing char < > at index 121: C:\Users\IdeaProjects\GlobalConfigEditor\target\scala-2.13\GlobalConfigEditor-SettingKey(This \ This \ This.
build.sbt
name := "GlobalConfigEditor"
version := "0.3"
scalaVersion := "2.13.1"
mainClass in assembly := Some("globalconfig.ConfigEditorApplication")
assemblyJarName in assembly := s"GlobalConfigEditor-$version.jar"
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs#_*) => MergeStrategy.discard
case PathList("reference.conf") => MergeStrategy.concat
case x => MergeStrategy.first
}
libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9"
libraryDependencies += "commons-io" % "commons-io" % "2.6"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "com.typesafe.scala-logging" % "scala-logging_2.13" % "3.9.2"
libraryDependencies += "com.typesafe.akka" %% "akka-actor-typed" % "2.6.3"
libraryDependencies += "org.fxmisc.richtext" % "richtextfx" % "0.10.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.1" % "test"
libraryDependencies += "org.scalamock" %% "scalamock" % "4.4.0" % Test
libraryDependencies += "org.mockito" % "mockito-scala_2.13" % "1.11.3"
libraryDependencies += "org.mockito" % "mockito-scala-scalatest_2.13" % "1.11.3"
plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
build.properties
sbt.version=1.3.8
Stack trace
[error] java.nio.file.InvalidPathException: Trailing char < > at index 107: C:\Users\user\GlobalConfigEditor\target\scala-2.13\GlobalConfigEditor-SettingKey(This \ This \ This
[error] at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:172)
[error] at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
[error] at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
[error] at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
[error] at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
[error] at java.io.File.toPath(File.java:2234)
[error] at sbt.io.IO$.createDirectory(IO.scala:330)
[error] at sbt.io.IO$.archive(IO.scala:643)
[error] at sbt.io.IO$.jar(IO.scala:619)
[error] at sbt.Package$.makeJar(Package.scala:164)
[error] at sbtassembly.Assembly$.makeJar$1(Assembly.scala:40)
[error] at sbtassembly.Assembly$.$anonfun$apply$13(Assembly.scala:81)
[error] at sbtassembly.Assembly$.$anonfun$apply$13$adapted(Assembly.scala:77)
[error] at sbt.util.Tracked$.$anonfun$outputChanged$1(Tracked.scala:102)
[error] at sbtassembly.Assembly$.apply(Assembly.scala:85)
[error] at sbtassembly.Assembly$.$anonfun$assemblyTask$1(Assembly.scala:244)
[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:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] at sbt.Execute.work(Execute.scala:290)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[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] (assembly) java.nio.file.InvalidPathException: Trailing char < > at index 107: C:\Users\user\GlobalConfigEditor\target\scala-2.13\GlobalConfigEditor-SettingKey(This \ This \ This
[IJ]sbt:GlobalConfigEditor>
Can anyone help me with this one?
Disclaimer: This is a cross-post of this issue on github.
This:
assemblyJarName in assembly := s"GlobalConfigEditor-$version.jar"
does not do what you want. version is a setting. When you want to access its value, you need to do this:
assemblyJarName in assembly := s"GlobalConfigEditor-${version.value}.jar"

Why does sbt assembly of a Spark application lead to "Modules were resolved with conflicting cross-version suffixes"?

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.

How to resolve log4javascript JS libraries in ScalaJS project

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.