Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one get sbt-idea to work in scala-2.10 project?

I had a lot of trouble getting sbt-idea to work in my Scala 2.10 project.

I tried compiling sbt-idea from its git repo, making sure that to have set

scalaVersion := "2.10.0-RC5"

in build/Build.scala, and using publish-local command to compile it in git. But I nevertheless keep getting

[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.

when I then use that in my published version, say by simply adding

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0-SNAPSHOT")

to the project/plugins.sbt file.

like image 752
Henry Story Avatar asked Dec 12 '12 18:12

Henry Story


2 Answers

Don't think you need to build SBT for Scala 2.10. I keep my gen-idea and eclipse project generators in the global build.sbt file and it works for all my projects (or so it seems ;-)

I'm using Ubuntu, so where the SBT config files are saved on your computer may be different.

Create a folder called plugins under the hidden sbt directory. On Linux this is located at ~/.sbt (where tilde is an alias for your home directory). So now you should have ~/.sbt/plugins

Then create a file called build.sbt under this directory and add the following to it:

resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

resolvers += "Sonatype releases"  at "https://oss.sonatype.org/content/repositories/releases/"

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT")

To test, I just generated a scala 2.10 project with it, and it seems fine.

Oh, the file above also adds support for the eclipse command in SBT if you want to generate Scala-IDE projects.

like image 59
Jack Avatar answered Oct 19 '22 12:10

Jack


I was able to use an older version of gen-idea by adding the following to project/plugins.sbt in the project itself:

import sbt._

import Defaults._

libraryDependencies += sbtPluginExtra(
    m = "com.github.mpeltonen" % "sbt-idea" % "1.2.0", // Plugin module name and version
    sbtV = "0.12",    // SBT version
    scalaV = "2.9.2"    // Scala version compiled the plugin
)
like image 3
Henry Story Avatar answered Oct 19 '22 14:10

Henry Story