Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any IDE supporting SBT?

is any IDE supporting SBT in a proper way (like Maven for example)? Because I've found a lot of tools that generate IDE-related configuration files but I haven't found any plugins that give any support of SBT interaction form within IDE.

I want to make an IDE-agnostic project based on SBT, but also I want to be able to use full spectrum of features that IDE provide and not just use it as an editor and do all the other stuff from console.

like image 978
Uko Avatar asked Dec 05 '22 13:12

Uko


2 Answers

Does Intellij fit the bill ? It has an SBT plugin (and a Scala plugin, obviously!)

like image 170
Brian Agnew Avatar answered Dec 17 '22 22:12

Brian Agnew


I know this isn't exactly what you're looking for, but putting it here as a work-around for working with SBT in eclipse for whoever is interested.

SBT generates eclipse config files, but after you import it, it works fine from within eclipse. You just need to set up the project for the first time outside of Eclipse, run SBT to resolve dependencies, generate eclipse structure using the eclipse sbt plugin and import into Eclipse. After that, you can run the code directly from Eclipse and it works fine.

Here're the steps in detail:

  1. Create the folder structure as follows: ScalaSBTProject

  2. Create a file called plugins.sbt in the project folder and add the following line to it:

    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
    
  3. Create build.sbt in the root directory i.e. ScalaSBTProject with content similar to the following. I'm using akka here, but add and remove libraries as you require:

    name := "ScalaSBTProject"
    
    version := "1.0"
    
    scalaVersion := "2.10.0-RC2"
    
    resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
    
    libraryDependencies += "com.typesafe.akka" % "akka-cluster-experimental_2.10.0-RC2" % "2.1.0-RC2"
    
  4. Open command prompt and run sbt in the directory ScalaSBTProject. SBT will download and resolve whatever dependencies are required

  5. Run the command eclipse at the SBT command line. This will generate all the eclipse related project files

  6. Import ScalaSBTProject into Eclipse using File->Import->Existing Project to workspace, and make sure you check Import into workspace

EDIT: Just as a Post-Script, you can quite easily create a batch file to take the name of the project and generate the eclipse compatible project, just a way to speed up the process.

like image 32
Plasty Grove Avatar answered Dec 17 '22 21:12

Plasty Grove