Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt dependency resolver with basic auth

I have nginx for my maven repository with basic authorization.

My build.sbt has:

credentials += Credentials("maven repository", "rep.com", "sbt", "password")

resolvers ++= Seq(
  "maven repository" at "http://rep.com:8080/"
)

but, sbt can't found module because sbt doesn't use basic authorization.

My nginx logs looks like:

012/07/22 20:02:21 [error] 3338#0: *14 no user/password was provided for basic authentication, client: 8.32.39.29, server: rep.com, request: "HEAD /some/cool_2.9.1/0.1-SNAPSHOT/cool_2.9.1-0.1-SNAPSHOT.pom HTTP/1.1", host: "rep.com:8080"

I don't wanna to publish artifacts through nginx. Basic auth need only for restricted access to artifacts.

How I can restrict access and working with repository in sbt?

like image 560
Timothy Klim Avatar asked Jul 22 '12 20:07

Timothy Klim


1 Answers

What about adding the following to your ~/.ivy2/.credentials:

realm=maven repository
host=rep.com:8080
user=username
password=password

and then use Credentials(Path.userHome / ".ivy2" / ".credentials")

you need to ensure that your realm is configured correctly: curl http://rep.com:8080 -vv 2>&1 | egrep "realm|host" (I might be mistaken, but 'host' may have to match the host header, i.e. rep.com:8080, not just rep.com).

hth

like image 188
Brett Avatar answered Sep 28 '22 11:09

Brett