Home > Software engineering >  SBT ignored unmanaged directory for Scala js
SBT ignored unmanaged directory for Scala js

Time:07-18

I have an old Scala 2.11 project where one of the libraries for Scala.js is not available any more. It's a multiproject build so, I created a lib folder inside of my Scala js project and in the settings of that project set:

unmanagedBase := baseDirectory.value / "lib"

When I go in the SBT shell to js project and type: unmanagedBase it shows correct path to the lib folder. But when I try to import the project in Intellij I'm getting this error:

[warn]  :: com.mediamath#scala-json_2.11;1.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      com.mediamath:scala-json_2.11:1.1 (/home/my_project/pg/build.sbt#L59)
[warn]         - js:js_sjs0.6_2.11:0.1-SNAPSHOT
[trace] Stack trace suppressed: run 'last js/*:ssExtractDependencies' for the full output.
[trace] Stack trace suppressed: run 'last js/*:update' for the full output.
[error] (js/*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: com.mediamath#scala-json_2.11;1.1: not found
[error] (js/*:update) sbt.ResolveException: unresolved dependency: com.mediamath#scala-json_2.11;1.1: not found

And I have scala-json_2.11-1.1.jar in my lib folder

CodePudding user response:

This warning

[warn]  Note: Unresolved dependencies path:
[warn]      com.mediamath:scala-json_2.11:1.1 (/home/my_project/pg/build.sbt#L59)
[warn]         - js:js_sjs0.6_2.11:0.1-SNAPSHOT

suggest that the actual issue that requires js:js_sjs0.6_2.11:0.1-SNAPSHOT, so some dependency related to Scala.js 0.6, while you provided scala-json_2.11-1.1.jar, a JAR dedicated for Scala.js 1.1.

Since you added a JAR as unmanaged, resolvers cannot perform evictions or suggest incompatibilities, and can merely verify whether dependencies are there or not, so you'd have to resolve them on your own.

You have some options like editing the MANIFEST file (if code would happen to be compatible between versions), or (if it's open source) compile the offending library yourself for Scala.js 1.1.

  • Related