Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT and External Libraries in Intellij

I am starting a Scala project and I'm using SBT and Intellij 13 as my IDE.

I have the following build.sbt file, but I can't seem to get the dependencies in the SBT "libraryDependencies" section to show up in "External Libraries" after running "sbt update".

The following is my build.sbt:

name := "myapp-scala"

version := "1.0"

scalaVersion := "2.10.3"

resolvers += "spray repo" at "http://repo.spray.io"

resolvers += "spray nightlies" at "http://nightlies.spray.io"

libraryDependencies ++= Seq(
  "com.typesafe.akka"  %% "akka-actor"       % "2.2.0",
  "com.typesafe.akka"  %% "akka-slf4j"       % "2.2.0",
  "ch.qos.logback"      % "logback-classic"  % "1.0.13",
  "io.spray"            % "spray-can"        % "1.2-20130712",
  "io.spray"            % "spray-routing"    % "1.2-20130712",
  "io.spray"           %% "spray-json"       % "1.2.3",
  "org.specs2"         %% "specs2"           % "1.14"         % "test",
  "io.spray"            % "spray-testkit"    % "1.2-20130712" % "test",
  "com.typesafe.akka"  %% "akka-testkit"     % "2.2.0"        % "test",
  "com.novocode"        % "junit-interface"  % "0.7"          % "test->default",
  "org.scalautils" % "scalautils_2.10" % "2.0",
  "org.scalatest" % "scalatest_2.10" % "2.0" % "test"
)

scalacOptions ++= Seq(
  "-unchecked",
  "-deprecation",
  "-Xlint",
  "-Ywarn-dead-code",
  "-language:_",
  "-target:jvm-1.7",
  "-encoding", "UTF-8"
)

Can anyone point me in the right direction?

enter image description here

like image 396
binarygiant Avatar asked Jan 18 '14 19:01

binarygiant


2 Answers

The best way to start working with IDEA 13 and a sbt project is this:

  • Make sure that you have the sbt plugin installed

enter image description hereenter image description hereenter image description here

  • If you have it installed, then simply start a sbt project:

enter image description hereenter image description here

This should fix everything up for you, and you can run your commands via the sbt console:

enter image description here

like image 135
Games Brainiac Avatar answered Oct 04 '22 09:10

Games Brainiac


To integrate Sbt with Intellij IDEA you need to use this plugin: https://github.com/mpeltonen/sbt-idea

It provides you with the Sbt task gen-idea which will generate the files required to configure IDEA with your project.

like image 33
vptheron Avatar answered Oct 04 '22 10:10

vptheron