12
votes

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

4
What versions of scala plugin and IDEA (13..what?) do you have?om-nom-nom
Scala Plugin version 0.26.361 InteilliJ version 13.0.1binarygiant
I just had the same issue with IDEA 13.1.1 and refreshing SBT projects did it for me (View -> Tool Window -> SBT -> Refresh all SBT projects)LMeyer

4 Answers

11
votes

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

1
votes

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.

0
votes

I had the same problem on IntelliJ CE 14.0.2 The project/app name under build.sbt and project/build.scala file need to be same. That helped fixing the issue for me.

0
votes

Similar to what @samspired said
I just made the sbt.Project variable name exactly like the name of the project module name and it solved the problem.
go to File -> Project Structure -> Modules
and see what the module name is - (it doesn't have to be like the project directory name but if you didn't change it, it's probably it )

// this file is in the path of "../Somewhere_in_file_system/MyProjectName/build.sbt"
lazy val MyProjectName /*this is the module name*/ = (project in file("."))
      .settings(
        scalaVersion := "2.11.8",
        name := "com-company-blabla-myproject" //..... and all the other sbt properties
    )