问题
What's the right way to use sbt with 2.10 trunk? I tried the obvious:
james@James-Moores-iMac:~/workspace/Deleteme3$ cat build.sbt
scalaVersion := "2.10.0-SNAPSHOT"
But that gives:
james@James-Moores-iMac:~/workspace/Deleteme3$ sbt compile
[info] Loading global plugins from /Users/james/.sbt/plugins
[info] Set current project to default-ee38f7 (in build file:/Users/james/workspace/Deleteme3/)
[info] Updating {file:/Users/james/workspace/Deleteme3/}default-ee38f7...
[info] Resolving org.scala-lang#scala-library;2.10.0-SNAPSHOT ...
[warn] module not found: org.scala-lang#scala-library;2.10.0-SNAPSHOT
[warn] ==== local: tried
[warn] /Users/james/.ivy2/local/org.scala-lang/scala-library/2.10.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-SNAPSHOT.pom
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-SNAPSHOT.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/james/workspace/Deleteme3/}default-ee38f7/*:update: sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[error] Total time: 1 s, completed Mar 18, 2012 10:39:29 AM
james@James-Moores-iMac:~/workspace/Deleteme3$
Trying the suggestion of the new sbt launcher with -sbt-snapshot fails too:
james@James-Moores-iMac:/tmp/sfasdf$ sbt -sbt-snapshot compile
Detected sbt version 0.12.0-SNAPSHOT
Using /Users/james/.sbt/0.12.0-SNAPSHOT as sbt dir, -sbt-dir to override.
Getting net.java.dev.jna jna 3.2.3 ...
:: retrieving :: org.scala-sbt#boot-jna
confs: [default]
1 artifacts copied, 0 already retrieved (838kB/13ms)
Getting org.scala-sbt sbt 0.12.0-20120319-052150 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
38 artifacts copied, 0 already retrieved (7712kB/159ms)
Getting Scala 2.9.1 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
4 artifacts copied, 0 already retrieved (19939kB/426ms)
[info] Set current project to wand (in build file:/private/tmp/sfasdf/)
Getting Scala 2.10.0-SNAPSHOT ...
downloading http://scala-tools.org/repo-snapshots/org/scala-lang/scala-compiler/2.10.0-SNAPSHOT/scala-compiler-2.10.0-20120319.161232-290.jar ...
[SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.0-SNAPSHOT!scala-compiler.jar (28525ms)
downloading http://scala-tools.org/repo-snapshots/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-20120319.161232-293.jar ...
[SUCCESSFUL ] org.scala-lang#scala-library;2.10.0-SNAPSHOT!scala-library.jar (16869ms)
downloading http://scala-tools.org/repo-snapshots/org/scala-lang/jline/2.10.0-SNAPSHOT/jline-2.10.0-20120319.161232-290.jar ...
[SUCCESSFUL ] org.scala-lang#jline;2.10.0-SNAPSHOT!jline.jar (1674ms)
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
4 artifacts copied, 0 already retrieved (21204kB/91ms)
[info] Updating {file:/private/tmp/sfasdf/}default-59a990...
[info] Resolving org.scala-lang#scala-library;2.10.0-SNAPSHOT ...
[warn] module not found: org.scala-lang#scala-library;2.10.0-SNAPSHOT
[warn] ==== local: tried
[warn] /Users/james/.ivy2/local/org.scala-lang/scala-library/2.10.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.0-SNAPSHOT/scala-library-2.10.0-SNAPSHOT.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/private/tmp/sfasdf/}default-59a990/*:update: sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.0-SNAPSHOT: not found
[error] Total time: 54 s, completed Mar 20, 2012 7:37:55 AM
回答1:
You cannot use trunk with SBT 0.11.0, and you'll never be able to do so. Newer SBT versions (snapshots of 0.12) can handle it.
回答2:
Use this version of the actual sbt script: https://raw.github.com/paulp/sbt-extras/master/sbt
Run with
sbt -sbt-snapshot
Add this to your build.sbt file:
scalaVersion := "2.10.0-SNAPSHOT"
resolvers += Resolver.sonatypeRepo("snapshots")
(added as a new answer to combine a couple answers in one place - but marked Daniel's answer as correct.)
来源:https://stackoverflow.com/questions/9760596/how-to-use-scala-2-10-trunk-with-sbt-0-11-0-unresolved-dependencies