Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT can't find in repository even though the file clearly is there

Tags:

scala

sbt

Is there something wrong in what the repository, http://teleal.org/m2, returns? This is my 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"
)

... and this is the error I get. The teleal.org-URLs here can be opened directly in a browser with now problems:

> 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

Update

Almost forgot; I'm using sbt-0.11.0 on Mac OS X.

Summary

The repository teleal.org replies to a head request from sbt by returning response status 204. The response status should have been the same as the get request 200. So sbt concludes that there's nothing to see here.

If teleal.org had chosen to not support head request like maven central this would have worked just fine; it think :-)

Side-note; sbt uses this interesting accept-header: 'Accept: text/html, image/gif, image/jpeg, *; q=.2, /; q=.2'

like image 570
thoredge Avatar asked Feb 19 '12 13:02

thoredge


1 Answers

To see the debug-level logging from the update task:

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

Alternatively, after running update, you can display the debug logging, which was persisted to disk but not shown:

> last update

You'll see:

[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

The HTTP response for that URL includes a HTTP redirect:

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 can follow redirects, but let's use the new repository directly to eliminate any doubt. Still doesn't work, we're still getting the 204 error.

> 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

That server is returning a HTTP 204 (No Content), but Ivy, as of version 2.2.0, is unable to handle this.

A workaround would be proxy that repository. The free version of Sonatype Nexus can do this, and is pretty easy to setup.

like image 183
retronym Avatar answered Nov 02 '22 10:11

retronym