2012-12-12 46 views
6

我在使用sbt-idea在我的Scala 2.10項目中工作時遇到了很多麻煩。如何獲得sbt-idea在scala-2.10項目中的工作?

我試圖從它的混帳回購編譯sbt-idea,確保在build/Build.scala已設置

scalaVersion := "2.10.0-RC5" 

,並使用publish-local命令編譯它飯桶。但我仍然不斷收到

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

當我再使用,在我的發佈版本,通過簡單地增加

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

project/plugins.sbt文件說。

回答

3

我能夠通過增加項目本身使用的gen-idea舊版本的以下內容project/plugins.sbt

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 
) 
7

不要以爲你需要建立SBT斯卡拉2.10。我將我的gen-idea和eclipse項目生成器保留在全局build.sbt文件中,它適用於我所有的項目(或者看起來如此;-)

我使用的是Ubuntu,所以保存了SBT配置文件在你的電腦上可能會有所不同。

在隱藏的sbt目錄下創建一個名爲plugins的文件夾。在Linux上,它位於~/.sbt(其中代字號是主目錄的別名)。所以,現在你應該有~/.sbt/plugins

然後創建一個名爲build.sbt文件這個目錄下,並添加以下代碼行:

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") 

爲了測試,我剛剛生成與它的Scala 2.10項目,它似乎罰款。

噢,如果你想生成Scala-IDE項目,上面的文件還增加了對SBT中eclipse命令的支持。

+0

謝謝。這實際上幫了很多忙。我還遇到了另一個問題,這使得解決這個問題變得非常困難。 –

+0

快樂@HenryStory,遺憾的是沒有幫助讓gen-idea本身在2.10上運行,但正如你注意到的,它似乎並不是先決條件。 – Jack

相關問題