sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.59k stars 439 forks source link

sbt-native-packager using 2.x of scala-xml which is incompatible with scala 2.12 and sbt #1517

Closed griffhun closed 1 year ago

griffhun commented 2 years ago

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

guizmaii commented 2 years ago

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

Christewart commented 1 year ago

Same issue on bitcoin-s: https://github.com/bitcoin-s/bitcoin-s/actions/runs/3022592631/jobs/4861854192

mkurz commented 1 year ago

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