我已经通过brew install sbt
在一台新机器(运行osx)上安装了sbt 0.13.8,现在我无法成功地从任何存储库中解析任何依赖,而不是默认的。
example/
build.properties
build.sbt
build.properties
的内容很简单:
sbt.version=0.13.8
build.sbt
的含量为:
lazy val root = (project in file(".")).
settings(
scalaVersion := "2.11.4",
libraryDependencies += "com.twitter.common.zookeeper" % "server-set" % "1.0.83",
resolvers += "Twitter Repository" at "http://maven.twttr.com"
)
该版本的依赖关系肯定存在于该存储库中,在http://maven.twttr.com/com/twitter/common/zookeeper/server-set/1.0.83/,然而,当我尝试compile
或update
的项目,它失败了,运行last
只是让我抓挠我的头:
$ sbt
[info] Set current project to root (in build file:/Users/rb/Workspace/example/)
> update
[info] Updating {file:/Users/rb/Workspace/example/}root...
[info] Resolving com.twitter.common.zookeeper#server-set;1.0.83 ...
[warn] module not found: com.twitter.common.zookeeper#server-set;1.0.83
[warn] ==== local: tried
[warn] /Users/rb/.ivy2/local/com.twitter.common.zookeeper/server-set/1.0.83/ivys/ivy.xml
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.twitter.common.zookeeper/server-set/1.0.83/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/twitter/common/zookeeper/server-set/1.0.83/server-set-1.0.83.pom
[info] Resolving jline#jline;2.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.twitter.common.zookeeper#server-set;1.0.83: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.twitter.common.zookeeper:server-set:1.0.83 (/Users/rb/Workspace/exampl/build.sbt#L4)
[warn] +- root:root_2.11:0.1-SNAPSHOT
...
> last
[info] Updating {file:/Users/rb/Workspace/example/}root...
[debug] Other repositories:
[debug] Default repositories:
[debug] Using inline dependencies specified in Scala.
...
> inspect resolvers
[info] Setting: scala.collection.Seq[sbt.Resolver] = List(Twitter Repository: http://maven.twttr.com)
[info] Description:
[info] The user-defined additional resolvers for automatically managed dependencies.
[info] Provided by:
[info] {file:/Users/rb/Workspace/example/}root/*:resolvers
[info] Defined at:
[info] /Users/rb/Workspace/example/build.sbt:5
[info] Reverse dependencies:
[info] *:externalResolvers
[info] Delegates:
[info] *:resolvers
[info] {.}/*:resolvers
[info] */*:resolvers
[info] Related:
[info] */*:resolvers
> show fullResolvers
[info] ArrayBuffer(Raw(ProjectResolver(inter-project, mapped: )), FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), URLRepository(typesafe-ivy-releases,Patterns(ivyPatterns=List(https://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(https://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), public: https://repo1.maven.org/maven2/)
[success] Total time: 0 s, completed 28-May-2015 10:50:23
正如您所看到的,当检查解析器时,twitter存储库在那里,但是当运行update
时,sbt甚至没有尝试使用它(并且它根本没有出现在last
输出的相当空的存储库列表中)。
我找不到任何线索,我做错了什么在文档或更新笔记。我错过了一个基本的配置文件或参数的地方,而最初安装sbt?
编辑:我已经设法通过附加到fullResolvers
而不是resolvers
来解决这个问题,如下所示:
lazy val root = (project in file(".")).
settings(
scalaVersion := "2.11.4",
libraryDependencies += "com.twitter.common.zookeeper" % "server-set" % "1.0.83",
fullResolvers += "Twitter Repository" at "http://maven.twttr.com"
)
适用于我的OS X,而不必使用fullResolvers
。
我不确定这是否相关,但您的build.properties
文件应该在项目目录下。
你的项目结构应该是这样的:
.
├── build.sbt
└── project
└── build.properties