com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
757 stars 117 forks source link

Unresolved dependency #216

Closed shivam-880 closed 3 years ago

shivam-880 commented 3 years ago

I am getting following error while resolving dependency:

[error] (parserJS / update) sbt.librarymanagement.ResolveException: 
Error downloading com.lihaoyi:scalatags_sjs1_2.11:0.6.8

My build.sbt looks like:

ThisBuild / scalaVersion := "2.11.8"

lazy val root = project.in(file(".")).aggregate(parser.js, parser.jvm)

lazy val parser = crossProject(JSPlatform, JVMPlatform).in(file(".")).
  settings(
    name := "rules-parser",
    version := "0.1",
    libraryDependencies ++= Seq(
      "com.lihaoyi" %% "fastparse" % "2.1.2",
      "com.chuusai" %%% "shapeless" % "2.4.0-M1",
      "org.scalactic" %%% "scalactic" % "3.2.2",
      "org.scalatest" %%% "scalatest" % "3.2.2" % "test"
    )
  ).
  jsSettings(
    scalaJSUseMainModuleInitializer := true,
    libraryDependencies ++= Seq(
      "org.scala-js" %%% "scalajs-dom" % "1.1.0",
      "com.lihaoyi" %%% "scalatags" % "0.6.8"
    )
  ).
  jvmSettings(
    libraryDependencies ++= Seq(
      "org.scala-js" %% "scalajs-stubs" % "1.0.0" % "provided"
    )
  )

I am facing the silimar issue when trying to include fastparse dependency in the the jsSettings.

plugins.sbt

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
shivam-880 commented 3 years ago

MVN doesn't seem to have com.lihaoyi:fastparse_sjs1_2.11:2.1.2

[error] (parserJS / update) sbt.librarymanagement.ResolveException: 
Error downloading com.lihaoyi:fastparse_sjs1_2.11:2.1.2

https://mvnrepository.com/artifact/com.lihaoyi/fastparse_sjs0.6_2.11/2.1.2

And same goes with scalatags!

shivam-880 commented 3 years ago

I figured out the issue. Apparently when using scalajs, the plugin version is also something that needs to keep in mind. In this particular case the plugin version is 1.x however the version of scalatags and fastparse I have included as dependencies pertain to scalajs plugin version 0.6.x which is what was causing this issue.