Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metals: Import Build stopped working #689

tpolecat opened this issue Apr 22, 2019 · 3 comments


2 participants
Copy link

commented Apr 22, 2019

Describe the bug

Metals: Import Build stopped working. It has been working fine for months, on this project in fact. I added a dependency and was unable to re-import.

To Reproduce

  1. Get Rob's machine.
  2. Open my Skunk project in vs-code.
  3. Open a .scala file and then do Metals: Import Build

Behold the log:

Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
Using JAVA options set in JAVA_OPTS
logging to file /Users/rnorris/Scala/skunk/.metals/metals.log
time: initialize in 0.79s
running 'sbt metalsEnable bloopInstall'
[info] Loading settings for project global-plugins from metals.sbt ...
[info] Loading global plugins from /Users/rnorris/.sbt/1.0/plugins
[info] Loading settings for project skunk-build from plugins.sbt ...
[info] Loading project definition from /Users/rnorris/Scala/skunk/project
[success] Generated .bloop/skunk-build.json
[success] Total time: 1 s, completed Apr 21, 2019 8:55:18 PM
[info] Loading settings for project skunk from build.sbt,version.sbt ...
[info] Set current project to skunk (in build file:/Users/rnorris/Scala/skunk/)
[error] Not a valid command: metalsEnable
[error] Not a valid project ID: metalsEnable
[error] Expected ':'
[error] Not a valid key: metalsEnable
[error] metalsEnable
[error]             ^
sbt exit: 1
time: ran 'sbt bloopInstall' in 13s
sbt command failed: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -jar /var/folders/kt/st5ktl_x5q735j6bk1tc9t4m00038z/T/metals1125816136586707218/sbt-launch.jar metalsEnable bloopInstall


  • Operating system: macOS
  • Editor: Visual Studio Code
  • Metals version: v0.5.0

Additional context

My /Users/rnorris/.sbt/1.0/plugins/metals.sbt looks correct, I think.

// DO NOT EDIT! This file is auto-generated.
// By default, this file does not do anything.
// If the environment variable METALS_ENABLED has the value 'true',
// then this file enables sbt-metals and sbt-bloop.

libraryDependencies := {
  import Defaults.sbtPluginExtra
  val oldDependencies = libraryDependencies.value
  if (System.getenv("METALS_ENABLED") == "true") {
    val bloopModule = "ch.epfl.scala" % "sbt-bloop" % "1.2.5"
    val metalsModule = "org.scalameta" % "sbt-metals" % "0.5.0"
    val sbtVersion =[Unit]("pluginCrossBuild")).value
    val scalaVersion =
    val bloopPlugin = sbtPluginExtra(bloopModule, sbtVersion, scalaVersion)
    val metalsPlugin = sbtPluginExtra(metalsModule, sbtVersion, scalaVersion)
    List(bloopPlugin, metalsPlugin) ++ oldDependencies.filterNot { dep =>
      (dep.organization == "ch.epfl.scala" && == "sbt-bloop") ||
      (dep.organization == "org.scalameta" && == "sbt-metals")
  } else {

This comment has been minimized.

Copy link

commented Apr 22, 2019

Thank you for reporting! Do you have sbt-coursier installed? What happens if you upgrade to sbt-coursier 1.1.0-M14-1? This looks related to #567


This comment has been minimized.

Copy link

commented Apr 22, 2019

No coursier but after some discussion with @olafurpg we tried

rm -rf project/target
rm -rf ~/.sbt/1.0/plugins/target/

and that fixed it! So if anyone else is in this situation it's worth a try.

@tpolecat tpolecat closed this Apr 22, 2019


This comment has been minimized.

Copy link

commented Apr 22, 2019

Another related issue #685 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.