Online dependence not found in .ivy2 file and not

2019-03-02 15:14发布

问题:

I have an IntelliJ Idea project that uses external libraries. I cannot find one of this libraries in the ~/.ivy2/cache directory. The sbt file looks like:

name := "myproject"
scalaVersion := "2.11.8"
lazy val toImport = RootProject(uri("someuri#hash"))
lazy val root = (project in file(".")).dependsOn(toImport)

IntelliJ Idea underlines the toImport line saying that it cannot find it. How can I solve this?

回答1:

If you mean the RootProject is highlighted red, it seem you've run into a problem with how IDEA imports transitive modules. I've reproduced this with the information from your other question and created an issue on the Scala plugin issue tracker: https://youtrack.jetbrains.com/issue/SCL-12355

To work around this problem, one "fix" is to manually rename the modules in project structure to this:

... but that will get lost after refreshing the project from sbt.

Instead, I suggest you enable the "use sbt for build and import" in the sbt options. You will have the highlighting error, but builds will work fine.