即使文件清楚存在,SBT也无法在存储库中找到

时间:2012-02-19 13:04:21

标签: scala sbt

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

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的头部请求。响应状态应该与获取请求200相同。因此,sbt得出结论,这里没有什么可看的。

如果teleal.org选择不支持像maven central这样的头部请求,那么这样做会很好;它认为: - )

侧面说明; sbt使用这个有趣的接受标题:'接受:text / html,image / gif,image / jpeg,*; q = .2, / ; Q = 0.2'

1 个答案:

答案 0 :(得分:5)

要查看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这个。

解决方法是代理该存储库。 free version of Sonatype Nexus可以执行此操作,并且很容易设置。