2

我正在尝试为具有 IntelliJ (12.1) 支持的 Scala (2.10) 设置一个带有 specs2 的空 sbt 项目,当我sbt compile在空项目目录中执行此操作时出现此错误:

% sbt compile                                                                                                                                                                                                 
Getting net.java.dev.jna jna 3.2.3 ...
:: retrieving :: org.scala-sbt#boot-jna
    confs: [default]
    1 artifacts copied, 0 already retrieved (838kB/32ms)
Getting org.scala-sbt sbt_2.9.1 0.11.3 ...
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    37 artifacts copied, 0 already retrieved (7245kB/734ms)
Getting Scala 2.9.1 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    4 artifacts copied, 0 already retrieved (19939kB/402ms)
[info] Loading project definition from /Users/pathikrit/Projects/scalgos/project
[info] Set current project to scalgos (in build file:/Users/pathikrit/Projects/scalgos/)
Getting Scala 2.10.1 ...
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    5 artifacts copied, 0 already retrieved (24386kB/107ms)
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn]  module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn]   /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.specs2#specs2_2.10.1;1.14: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[error] Total time: 4 s, completed Mar 25, 2013 5:11:17 PM

我的build.sbt文件如下所示:

name := "scalgos"

version := "0.0.1"

scalaVersion := "2.10.1"

libraryDependencies += "org.specs2" %% "specs2" % "1.14" % "test"

我通过以下方式安装了 sbt brew install sbt

% brew info sbt                                                                                                                                                                                   
sbt: stable 0.12.2, devel 0.13.0-M1
http://www.scala-sbt.org
/usr/local/Cellar/sbt/0.11.3-2 (3 files, 1.1M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/sbt.rb
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT.
For convenience, this can specified in `~/.sbtconfig`.

For example:
    SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"

Brew 说我有 sbt 0.12 但是当sbt --version我得到:

% sbt --version                                                                                                                                                                                    
sbt launcher version 0.11.3-2

我试图通过将它放在我的 $PROJECT_DIR/projects/plugins.sbt 中来至少生成 IntelliJ 文件:

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

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

但是当我这样做时sbt gen-idea,我得到了这个错误:

% sbt gen-idea                                                                                                                                                                                               
[info] Loading project definition from /Users/pathikrit/Projects/scalgos/project
[info] Set current project to scalgos (in build file:/Users/pathikrit/Projects/scalgos/)
[info] Trying to create an Idea module scalgos
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn]  module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn]   /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.specs2#specs2_2.10.1;1.14: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn]  module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn]   /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.specs2#specs2_2.10.1;1.14: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[error] Failed to obtain dependency classpath
[error] java.lang.IllegalArgumentException
[error] Use 'last' for the full log.

有人可以发布一个可以build.sbt为 Scala 2.10.1 和 sbt 生成 IntelliJ 12.1 文件的示例吗?

我在这里检查了我的项目:https ://github.com/pathikrit/scalgos

请指教我做错了什么???

4

2 回答 2

6

你可以使用我建立的这个项目,它提供你正在寻找的开箱即用的东西

骨骼

我计划今晚升级 sbt 配置和最新最好的库(sbt-idea 1.3.0 和 scala 2.10.1)。

请享用!

于 2013-03-26T17:35:11.613 回答
2

您应该将 sbt 版本更新为 0.12.X,创建文件“project/build.properties”,然后输入“sbt.version=0.12.1”

我分叉了你的 repo 并编辑了 sbt 版本,在我的机器上似乎工作正常

https://github.com/yuanw/scalgos

于 2013-03-25T21:56:53.463 回答