Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install library with SBT libraryDependencies in an Intellij project

I am very new to SBT, Breeze and IntelliJ, though I have a decent grasp of Scala and I am trying to install the Breeze library, which I think is managed.

What I've done:

I followed the instructions on this page and added this script to the build.sbt file in my project:

libraryDependencies  ++= Seq(
            // other dependencies here
            "org.scalanlp" %% "breeze" % "0.10",
            // native libraries are not included by default. add this if you want them (as of 0.7)
            // native libraries greatly improve performance, but increase jar sizes.
            "org.scalanlp" %% "breeze-natives" % "0.10"
)

resolvers ++= Seq(
            // other resolvers here
            "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
)

// Scala 2.9.2 is still supported for 0.2.1, but is dropped afterwards.
scalaVersion := "2.11.1" // or 2.10.3 or later

I then ran sbt update in the project directory (via the terminal), and saw that all the pieces of Breeze downloaded.

I then tried re-running sbt update, but this did not trigger another download.

Issue:

The problem is that I cannot access the library via IntelliJ. import breeze._ gives the standard Cannot resolve symbol breeze and I couldn't find any mention of Breeze in "Project Structure." It isn't in the lib directory of the project either.

Am I missing a step?

like image 694
TimY Avatar asked May 21 '15 15:05

TimY


People also ask

How do I import an existing sbt project into IntelliJ?

After you have an sbt build – one you created yourself or from a template – follow these steps to import the project into IntelliJ IDEA: From the Welcome Screen or File menu, select Open. Browse to and select the top-level folder of your sbt project, and click OK. The Import Project from SBT dialog opens.

How do we specify library dependencies in sbt?

The libraryDependencies key Most of the time, you can simply list your dependencies in the setting libraryDependencies . It's also possible to write a Maven POM file or Ivy configuration file to externally configure your dependencies, and have sbt use those external configuration files.

How do I run an sbt Assembly in IntelliJ?

IntelliJ now allows you to create a run configuration for an SBT task. You create the Run Configuration by : choosing "Edit configurations" from the "Run" menu (or the toolbar popup) click the "+" button to add a configuration and select "SBT Task" as the type of configuration you want to make.


1 Answers

Sounds like a bug in the IntelliJ project, try removing the .idea directory from the project directory and then re-import the project into IntelliJ using the wizard.

like image 141
Callum Avatar answered Nov 15 '22 05:11

Callum