Problems with SBT dependencies in Intellij Idea

2020-02-07 05:51发布

问题:

This is a problem that is really getting on my nerves. I'm writing proofs for the Welder proof assistant. I was doing so without the help of an IDE and following an SBT-based building approach. This is the build file:

name := "proofs"
scalaVersion := "2.11.8"
lazy val welder = RootProject(uri("git://github.com/epfl-lara/welder.git#2b9dd10a7a751777cc9cda543ce888294113c0b1"))
lazy val root = (project in file(".")).dependsOn(welder)

I tried to bring my project into an Intellij Idea project. However, while doing so, the IDE won't recognize the imports of the external library:

import inox._

How can I solve this issue?

Edit

I stress that the compile errors are produced in the files from Welder

Here is the welder project/Build.scala file

import sbt._

object WelderBuild extends Build {

  lazy val root = Project("root", file(".")) dependsOn(inoxProject)
  lazy val inoxProject = RootProject(uri("git://github.com/epfl-lara/inox.git#53ea4533a957050bd6a968d5a340890bd54998a5"))

}

回答1:

See my answer to your other question and the issue on the Scala plugin issue tracker.

Renaming the modules and manually adding a dependency from the welder-root to the inox-root module will solve the compile path issue, but the build will still fail because one of the project uses source generators, which are not supported in IDEA directly.

Instead, enable the "use sbt for build and import" option in the sbt preferences: