-
Notifications
You must be signed in to change notification settings - Fork 950
Closed
Labels
Description
steps
Repo to reproduce: https://github.com/olafurpg/scalafmt/files/521826/issue485.zip
problem
Running scalafmt
results in errors
[error] Modules were resolved with conflicting cross-version suffixes in {file:/Users/heiko/projects/scala/new-in-scala-212/}new-in-scala-212:
[error] org.scala-lang.modules:scala-xml _2.11, _2.12.0-RC1
OR
java.lang.NoClassDefFoundError: scala/Product$class
at org.scalafmt.config.Docstrings$ScalaDoc$.<init>(Docstrings.scala:8)
at org.scalafmt.config.Docstrings$ScalaDoc$.<clinit>(Docstrings.scala)
at org.scalafmt.config.ScalafmtConfig$.apply$default$2(ScalafmtConfig.scala:2)
at org.scalafmt.config.Settings$class.$init$(Settings.scala:17)
at org.sc
I am unable to reproduce the issue with sbt.version=0.13.11
in build.properties.
I tried the following with no success:
dependencyOverrides += "org.scala-lang" % "scala-library" % org.scalafmt.Versions.scala % "scalafmt"
// and
libraryDependencies += "org.scala-lang" % "scala-library" % org.scalafmt.Versions.scala % "scalafmt" force()
However, changing to typelevel/scala fixes the issue (PR: https://github.com/olafurpg/scalafmt/pull/522):
libraryDependencies += "org.typelevel" % "scala-library" % org.scalafmt.Versions.scala % "scalafmt"
expectation
I expected the scalafmt
task to run without error.
More specifically, I expect the 0.13.12 resolver to not evict org.scala-lang:scala-library:2.11.8
from the scalafmt
configuration in favor of org.scala-lang:scala-libary:2.12.0-RC1
defined in the default
/compile
configuration.
notes
- Potential cause of this issue: Override scala organization and version transitively at the Ivy level #2634
- Original scalafmt issue: https://github.com/olafurpg/scalafmt/issues/485#issuecomment-253978435
- Scalafmt is 2.11 only. To overcome the 2.10 requirement for SBT plugins, the scalafmt SBT plugin uses a custom configuration to classload scalafmt with 2.11.8 scala-library.
- Attempts to port scala.meta (a scalafmt dependency) to 2.10 have so far been unsuccessful: port scala.meta to 2.10 scalameta/scalameta#295
timothyklim, lloydmeta, dluc, BusyByte, henrikno and 5 more