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

2

6

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.

Saidee answered 12/12, 2012 at 18:6 Comment(0)
R
7

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.

Reposition answered 12/12, 2012 at 18:51 Comment(2)
thanks. That in fact helped a lot. I also had another problem that was getting in the way, making it doubly difficult to fix this.Saidee
Pleasure @HenryStory, sorry for not helping on getting gen-idea itself running on 2.10, but as you noticed, it does not seem to be a pre-requisite.Reposition
S
3

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
)
Saidee answered 12/12, 2012 at 18:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.