什么是sbt 0.11的sbt-idea的正确设置?

时间:2011-12-28 22:03:33

标签: sbt sbt-idea

我正在使用sbt 0.11.2和sbt-idea创建一个Scala项目,我在UNRESOLVED DEPENDENCIES任务上获得了gen-idea

我刚刚安装了sbt(按照wiki中的说明下载了jar和make脚本),然后按照sbt-idea设置here,为我的项目创建了一个空目录,然后运行sbt然后运行{ {1}}任务。

它无法找到依赖项,因为它只使用内置的repos。如何告诉sbt检查另一个回购?


当我将gen-idea文件放在build.sbt目录中并运行sbt时,它会开始解析事物,其中一个是plugins

在此过程的后期,它会成功下载:

Resolving com.github.mpeltonen#sbt-idea;0.11.0 ...

当我运行[info] downloading http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.jar ... [info] [SUCCESSFUL ] com.github.mpeltonen#sbt-idea;0.11.0!sbt-idea.jar (592ms) 任务时,事情看起来很不错......

gen-idea

它继续创建> gen-idea [info] Trying to create an Idea module default-b91f2c 目录等,似乎创建得很好。然后它开始再次解决问题(scala tools,sbt,commens- *等)

最终它会尝试解析.idea

sbt-idea

我知道它不会在那些位置找到它,但我不明白为什么它没有尝试github repo,就像配置插件时那样。我期待看到这样的一行:

[warn]  module not found: com.github.mpeltonen#sbt-idea;0.11.0
[warn] ==== local: tried
[warn]   /home/scaladev/.ivy2/local/com.github.mpeltonen/sbt-idea/scala_2.9.1/sbt_0.11.2/0.11.0/ivys/ivy.xml
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/com.github.mpeltonen/sbt-idea/0.11.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn]   http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[warn] ==== Scala-Tools Maven2 Snapshots Repository: tried
[warn]   http://scala-tools.org/repo-snapshots/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[info] Resolving commons-io#commons-io;2.0.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.github.mpeltonen#sbt-idea;0.11.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.github.mpeltonen:sbt-idea:0.11.0 (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn] 

2 个答案:

答案 0 :(得分:3)

sbt 0.11.2的gen-idea插件尚未发布,但0.11.1-SNAPSHOT版本应按预期工作:

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

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

答案 1 :(得分:2)

这在sbt-idea自述文件here中有记录。具体做法是:

  

将以下行添加到〜/ .sbt / plugins / build.sbt或PROJECT_DIR / project / plugins.sbt

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

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

注意:如果您在安装sbt 0.11时遇到问题,see this