【问题标题】:SBT can't find in repository even though the file clearly is there即使文件明确存在,SBT 也无法在存储库中找到
【发布时间】:2012-02-22 06:35:56
【问题描述】:

存储库http://teleal.org/m2 返回的内容有问题吗?这是我的 build.sbt -文件:

organization := "org.messy"

name := "mess"

version := "1-SNAPSHOT"

scalaVersion := "2.9.1"

libraryDependencies ++= Seq(
  "org.teleal.cling" % "cling-core" % "1.0.5",
  "org.teleal.cling" % "cling-support" % "1.0.5"
)

resolvers ++= Seq(
  "cling" at "http://teleal.org/m2"
)

...这是我得到的错误。此处的 teleal.org-URL 可以直接在浏览器中打开,但现在存在问题:

> compile
[info] Updating {file:*************************************************}default-d33f58...
[warn]      module not found: org.teleal.cling#cling-core;1.0.5
[warn] ==== local: tried
[warn]   ********************/.ivy2/local/org.teleal.cling/cling-core/1.0.5/ivys/ivy.xml
[warn]   -- artifact org.teleal.cling#cling-core;1.0.5!cling-core.jar:
[warn]   ********************/.ivy2/local/org.teleal.cling/cling-core/1.0.5/jars/cling-core.jar
[warn] ==== cling: tried
[warn]   http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[warn]   -- artifact org.teleal.cling#cling-core;1.0.5!cling-core.jar:
[warn]   http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.jar
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[warn]   -- artifact org.teleal.cling#cling-core;1.0.5!cling-core.jar:
[warn]   http://repo1.maven.org/maven2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn]   http://scala-tools.org/repo-releases/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[warn]   -- artifact org.teleal.cling#cling-core;1.0.5!cling-core.jar:
[warn]   http://scala-tools.org/repo-releases/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.jar
[warn]      ::::::::::::::::::::::::::::::::::::::::::::::
[warn]      ::          UNRESOLVED DEPENDENCIES         ::
[warn]      ::::::::::::::::::::::::::::::::::::::::::::::
[warn]      :: org.teleal.cling#cling-core;1.0.5: not found
[warn]      ::::::::::::::::::::::::::::::::::::::::::::::    [error] {file:*************************************************}default-d33f58/*:update: sbt.ResolveException: unresolved dependency: org.teleal.cling#cling-core;1.0.5: not found
[error] Total time: 4 s, completed Feb 19, 2012 1:44:38 PM

更新

差点忘了;我在 Mac OS X 上使用 sbt-0.11.0。

总结

存储库 teleal.org 通过返回响应状态 204 来回复来自 sbt 的 head 请求。响应状态应该与 get 请求 200 相同。所以 sbt 得出结论,这里没有什么可看的。

如果 teleal.org 选择不支持像 maven Central 这样的 head 请求,这将工作得很好;它认为:-)

旁注; sbt 使用这个有趣的 accept-header: 'Accept: text/html, image/gif, image/jpeg, *; q=.2, /; q=.2'

【问题讨论】:

  • 不是说这解决了问题,而是sbt的最新版本是0.11.2

标签: scala sbt


【解决方案1】:

要查看来自update 任务的调试级日志记录:

> set logLevel in update := Level.Debug
> update

或者,在运行update 之后,您可以显示调试日志,该日志已持久化到磁盘但未显示:

> last update

你会看到:

[debug]      trying http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[debug]         tried http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[debug] HTTP response status: 204 url=http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[debug]     cling: resource not reachable for org/teleal/cling#cling-core;1.0.5: res=http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom

该 URL 的 HTTP 响应包含一个 HTTP 重定向:

Request URL:http://teleal.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
Request Method:GET
Status Code:302 Found

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:teleal.org
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11

HTTP/1.1 302 Found
Date: Mon, 20 Feb 2012 10:32:11 GMT
Server: Jetty()
Location: http://4thline.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1316
Connection: close

Ivy 可以跟踪重定向,但让我们直接使用新的存储库来消除任何疑问。仍然不起作用,我们仍然收到 204 错误。

> set libraryDependencies += "org.teleal.cling" % "cling-core" % "1.0.5"
[info] Reapplying settings...
[info] Set current project to default-759082 (in build file:/Users/jason/code/scratch/20120220/)
> set resolvers += "4thline" at "http://4thline.org/m2" 
> update
...
> last update
...
[debug]      trying http://4thline.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[debug]         tried http://4thline.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom
[debug] HTTP response status: 204 url=http://4thline.org/m2/org/teleal/cling/cling-core/1.0.5/cling-core-1.0.5.pom

该服务器返回 HTTP 204(无内容),但 Ivy,从 2.2.0 版开始,is unable to handle this。

一种解决方法是代理该存储库。 free version of Sonatype Nexus 可以做到这一点,而且很容易设置。

【讨论】:

  • 谢谢;请参阅我的问题底部的摘要。
猜你喜欢
  • 1970-01-01
  • 2017-08-06
  • 2018-03-09
  • 2017-05-26
  • 2015-10-26
  • 1970-01-01
  • 2014-02-20
  • 2016-04-17
  • 2011-07-21
相关资源
最近更新 更多