Hen*_*ory 6 scala sbt sbt-idea
我在scala 2.10项目中使用sbt-idea工作时遇到了很多麻烦.
我尝试sbt-idea从它的git repo 编译,确保已经设置
scalaVersion := "2.10.0-RC5"
Run Code Online (Sandbox Code Playgroud)
in build/Build.scala,并使用publish-local命令在git中编译它.但我仍然坚持下去
[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.
Run Code Online (Sandbox Code Playgroud)
当我在我发布的版本中使用它时,简单地说添加
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0-SNAPSHOT")
Run Code Online (Sandbox Code Playgroud)
到project/plugins.sbt文件.
不认为你需要为Scala 2.10构建SBT.我保留了我的创意和eclipse项目生成器在全局build.sbt文件中,它适用于我的所有项目(或者看起来似乎;-)
我正在使用Ubuntu,因此SBT配置文件保存在您的计算机上可能会有所不同.
创建一个plugins在隐藏的sbt目录下调用的文件夹.在Linux上,它位于~/.sbt(tilde是您的主目录的别名).所以现在你应该有~/.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")
Run Code Online (Sandbox Code Playgroud)
为了测试,我刚用它生成了一个scala 2.10项目,看起来很好.
哦,eclipse如果你想生成Scala-IDE项目,上面的文件还增加了对SBT中命令的支持.
我可以通过在项目本身中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
)
Run Code Online (Sandbox Code Playgroud)