question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relative path for compiler plugin while using sbt >= 1.4.0 breaks compilation.

See original GitHub issue

I’ve noticed that when using sbt >= 1.4.0 and sbt-bloop, there is a difference in how a compiler plugin is listed under project.scala.options in the bloop json file. We’ll use wart remover as an example. When using sbt 1.3.13 and wart remover the path to the plugin is absolute and pointing towards my coursier cache. However, in sbt >= 1.4.0 it’s a relative path to /target/compiler_plugins/<plugin>. For example using 1.3.13

"project": {
  "scala": {
    "options": [
      "-Xplugin:/Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/wartremover/wartremover_2.13.3/2.4.13/wartremover_2.13.3-2.4.13.jar"
    ]
  }
}

Using >= 1.4.0

"project": {
  "scala": {
    "options": [
      "-Xplugin:target/compiler_plugins/wartremover_2.13.3-2.4.13.jar",
    ]
  }
}

This causes issues when compiling:

❯ bloop compile (bloop projects)
Compiling wart-remover-bloop (1 Scala source)
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Var
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.TryPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.TraversableOps
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Throw
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.StringPlusAny
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Serializable
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Return
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Product
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.OptionPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Null
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.NonUnitStatements
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.IsInstanceOf
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.EitherProjectionPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.DefaultArguments
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.AsInstanceOf
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Any
Compiled wart-remover-bloop (92ms)
[E] Failed to compile 'wart-remover-bloop-test','wart-remover-bloop'

If the path is changed to an absolute path pointing in the target directory, then there is no problem. I’m unsure if that path is given from sbt in this manner, if Bloop is in charge of getting it from sbt and making sure it’s absolute, or even something else.

You can reproduce this by the following steps

  • Run g8 scala/hello-world.g8
  • Add in addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.13")
  • Add in addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.5-8-6cc6911d")
  • Run sbt bloopInstall
  • Run bloop compile $(bloop projects)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sjrdcommented, Dec 3, 2020

but doesn’t follow with /

Because of Windows and its C:\ or C:/

Read more comments on GitHub >

github_iconTop Results From Across the Web

sbt Reference Manual — Combined Pages
From sbt shell, press up-arrow twice to find the compile command that you executed at the beginning. sbt:foo-build> compile. Getting help. Use the...
Read more >
scalacenter/bloop - Gitter
Hi, I'm loving bloop and have been using it for a simple sbt/scala project on OSX (scala 2.13.2). After changing the directory and...
Read more >
Enhanced Package Prefixes | The Scala Plugin Blog
Let's see how the upcoming version of the Scala plugin combines package prefixes with chained package clauses and relative imports.
Read more >
sbt-protoc error File does not reside within any path specified ...
There are multiple things to fix in build.sbt to update for sbt-protoc 1.0.x. Perhaps it was relying on old behaviors that were fixed....
Read more >
sbt-idea-plugin - Scaladex
SBT plugin that makes development of IntelliJ Platform plugins in Scala easier ... Clone the sources and open the build.sbt via File |...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found