【问题标题】:Cannot import scalate, after downloading with SBT使用 SBT 下载后无法导入 scalate
【发布时间】:2013-12-09 02:25:16
【问题描述】:

我的build.sbt

libraryDependencies += "org.fusesource.scalate" % "scalate-core" % "1.6.1" from "http://repo.fusesource.com/nexus/content/repositories/public/org/fusesource/scalate/"

resolvers += "FuseSource Public Repository" at "http://repo.fusesource.com/nexus/content/repositories/public"

我跑了

$ sbt update

成功下载了所有的cf

[info] downloading http://repo.fusesource.com/nexus/content/repositories/public/org/fusesource/scalate/ ...
[info]  [SUCCESSFUL ] org.fusesource.scalate#scalate-core;1.6.1!scalate-core.com/nexus/content/repositories/public/org/fusesource/scalate/ (617ms)

但是当我尝试使用它时

$ sbt console
> import org.fusesource

传递依赖 hawtjnijansi 在范围内,但不在 scalate

我做错了什么?

更新:

我检查了~/.ivy2/cache/org.fusesource.scalate/,它存在。

回答:

sbt 0.11.1 doesn't retrieve scalatra 2.1.0-SNAPSHOT dependency解决

【问题讨论】:

    标签: sbt scalate


    【解决方案1】:

    核弹~/.ivy2 和/或~/.sbt 和/或~/.m2

    ...我应该一次检查一个目录或子目录,但我很想写我的比特币价格监视器;)

    【讨论】:

      【解决方案2】:

      在你的 build.sbt 中试试这个:

      resolvers += "FuseSource Public Repository" at
        "http://repo.fusesource.com/nexus/content/repositories/public"
      
      libraryDependencies +=
        "org.fusesource.scalate" %% "scalate-core" % "1.6.1"
      

      我做了两件事:

      1) 使用 %% 而不是 %,因此 Scala 版本会自动附加到工件名称。 (也可以使用 %,但将 scalate-core 更改为 scalate-core_2.10,假设您使用的是 Scala 2.10.x 版本。)

      2) 省略from 子句。如果您有正确的解析器,则不需要它。

      将这些设置添加到一个空的 sbt 0.13 项目后,我看到:

      > show fullClasspath
      [info] Updating {file:/Users/tisue/foo/}foo...
      [info] Resolving org.fusesource.jansi#jansi;1.4 ...
      [info] downloading http://repo1.maven.org/maven2/org/fusesource/scalate/scalate-core_2.10/1.6.1/scalate-core_2.10-1.6.1.jar ...
      [info]  [SUCCESSFUL ] org.fusesource.scalate#scalate-core_2.10;1.6.1!scalate-core_2.10.jar(bundle) (1265ms)
      [info] downloading http://repo1.maven.org/maven2/org/fusesource/scalate/scalate-util_2.10/1.6.1/scalate-util_2.10-1.6.1.jar ...
      [info]  [SUCCESSFUL ] org.fusesource.scalate#scalate-util_2.10;1.6.1!scalate-util_2.10.jar(bundle) (274ms)
      [info] downloading http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar ...
      [info]  [SUCCESSFUL ] org.slf4j#slf4j-api;1.6.1!slf4j-api.jar (198ms)
      [info] Done updating.
      [info] List(Attributed(/Users/tisue/foo/target/scala-2.10/classes),
                  Attributed(/Users/tisue/.sbt/boot/scala-2.10.2/lib/scala-library.jar),
                  Attributed(/Users/tisue/.ivy2/cache/org.fusesource.scalate/scalate-core_2.10/bundles/scalate-core_2.10-1.6.1.jar),
                  Attributed(/Users/tisue/.ivy2/cache/org.fusesource.scalate/scalate-util_2.10/bundles/scalate-util_2.10-1.6.1.jar),
                  Attributed(/Users/tisue/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.1.jar),
                  Attributed(/Users/tisue/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.0.jar),
                  Attributed(/Users/tisue/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.0.jar))
      

      为清楚起见添加了缩进。请注意,主 scalate jar 已下载到 ~/.ivy2/cache/org.fusesource.scalate/scalate-core_2.10/bundles/scalate-core_2.10-1.6.1.jar

      【讨论】:

      • 谢谢,但仍然不会导入。我应该在哪里找到图书馆? find . | grep scalate 什么也没显示。
      • 我添加了一份成绩单,显示了罐子的最终位置,以及您将如何找出它们的最终位置。 Sam 对 nuke ~/.ivy2 的建议很好;使用from 的失败尝试可能会在那里留下错误文件。
      • 谢谢!我记得看到过类似“org.fusesource.scalate#scalate-core_2.10;1.6.1!...”之类的东西,但不像“List(Attributed(...))”之类的东西,下次我会更加注意。另外,“拙劣”的意思是我在不应该使用 from 时使用了,或者我 C-c 了一些进程,或者同时使用了 from 而不是 from,或者是什么?
      • 如果你使用from 告诉sbt“依赖A 在这个URL,我向你保证!”,那么sbt 会相信你,而不仅仅是相信你,还会缓存检索到的工件。我不认为更改 from 中的 URL 或完全删除 from 会触发从正确位置检索 sbt 已经在缓存中存在的东西,因为它来自不正确的位置。跨度>
      • 我会 thinkhope Ivy 在 C-c、网络变得很糟糕等方面很强大,但我不确定。
      猜你喜欢
      • 2017-11-29
      • 1970-01-01
      • 2011-08-04
      • 2017-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-19
      • 2018-11-10
      相关资源
      最近更新 更多