sbt-native-packager
sbt-native-packager copied to clipboard
sbt-native-packager using 2.x of scala-xml which is incompatible with scala 2.12 and sbt
Expected behaviour
sbt-native-packager should work with scala 2.12 because it is a scala plugin.
// Do NOT upgrade these dependencies to 2.x or newer! sbt-native-packager is a sbt-plugin
// and gets published with Scala 2.12, therefore we need to stay at the same major version
// like the 2.12.x Scala compiler, otherwise we run into conflicts when using sbt 1.5+
// See https://github.com/scala/scala/pull/9743
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", // Do not upgrade beyond 1.x
"org.scala-lang.modules" %% "scala-xml" % "2.1.0" <-- this should be below 2.x
Actual behaviour
https://github.com/sbt/sbt-native-packager/blob/bcac648d8bc03926734a010a9fd11711bfc9ec57/build.sbt#L41-L51
After updating our project to sbt.native.packager 1.9.10 or 1.9.11 from 1.9.9:
[error] * org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over 1.2.0
[error] +- com.github.sbt:sbt-native-packager:1.9.11 (sbtVersion=1.0, scalaVersion=2.12) (depends on 2.1.0)
[error] +- com.typesafe.play:twirl-api_2.12:1.5.1 (depends on 1.2.0)
If I try update scala-xml dependency for twirl project:
[error] * org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over 1.0.6
[error] +- com.typesafe.play:twirl-api_2.12:1.6.0-M6+37-1c63ce71+20220826-1058-SNAPSHOT (depends on 2.1.0)
[error] +- org.scala-lang:scala-compiler:2.12.16 (depends on 1.0.6)
Which suggests me it's not working with scala 2.12.
Information
- What sbt-native-packager are you using 1.9.9 <- works well, updating to 1.9.10 or 1.9.11 complains
- What sbt version 1.7.1
- What is your build system MacOS and Ubuntu
- What package are you building docker
- What version has your build tool: Docker version 20.10.17
- What is your target system Ubuntu 22.04
The issue is more with scala-compiler
than sbt-native-packager I think.
The issue will be fixed with the next version of Scala 2.12: https://github.com/scala/bug/issues/12632
Same issue on bitcoin-s: https://github.com/bitcoin-s/bitcoin-s/actions/runs/3022592631/jobs/4861854192
Scala 2.12.17 is out and has scala-xml upgraded: https://github.com/scala/scala/pull/10108 The next sbt release will upgrade to Scala 2.12.17 as well: https://github.com/sbt/sbt/pull/7021