1

I have two separate Scala projects. In both projects, the build.sbt has the line:

lazy val V = _root_.scalafix.sbt.BuildInfo

The two projects contain several projects so both build.sbt files are multi-project builds. In my research, I came across the idea of a root project and I think _root_ in the above value denotes the root project.

My problem is that in one of the projects, sbt cannot resolve the symbol scalafix in lazy val V = _root_.scalafix.sbt.BuildInfo. When I search scalafix.sbt.BuildInfo in this project, I can find the related jar but sbt somehow misses it. The two projects in so far as I can tell are almost identical but one resolves scalafix while the other does not.

For both projects, the jar seems to be located at the below directory in my Mac:

/Users/soft/.ivy2/cache/scala_2.12/sbt_1.0/ch.epfl.scala/sbt-scalafix/jars/sbt-scalafix-0.6.0-M19.jar!/scalafix/sbt

What is _root_ and how can I help sbt resolve scalafix?

Gakuo
  • 845
  • 6
  • 26
  • 2
    Possible duplicate of [What is the \_root\_ package in Scala?](https://stackoverflow.com/questions/687071/what-is-the-root-package-in-scala) – Patrick W Dec 14 '18 at 06:02

1 Answers1

1

I think root in the above value denotes the root project.

No, this is not true.

All sbt files are scala code and _root_ has the same meaning as _root_ in scala. Thus the answer is the same as in What is the root package in Scala.

The two projects in so far as I can tell are almost identical but one resolves scalafix while the other does not.

The problem is most probably the missing sclafix plugin.

Check that the plugin is enabled in project/plugins.sbt with line

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.1")
Ivan Stanislavciuc
  • 7,140
  • 15
  • 18