Skip to content

0.13.12 regression in resolving org.scala-lang:scala-library in custom configuration #2786

@olafurpg

Description

@olafurpg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions