Here is brief instruction how to access repositories protected by basic authentication from sbt - checked with version 0.13. That's how one would configure custom repository in
resolvers ++= Seq(
"MyRepositoryName" at "http://repository.host.com/nexus/content/repositories/releases",
If repository requires authentication - sbt would just show rather meaningless warning and claim that artifact isn't found:
[warn] ==== MyRepositoryName: tried
[warn] http://repository.host.com/nexus/content/repositories/releases/... here goes path to artifact ...
You'll need to know authentication realm returned by repository server in order to configure credentials. Realm can be found in WWW-Authenticate header of response - for example in output of following command:
curl -X GET -v http://... here goes attempted URL from sbt log warning ...
< WWW-Authenticate: BASIC realm="Repository Realm"
There are 3 options for specifying credentials: directly in
file or in separete file (usually in home directory).
- In project .sbt file:
But there's obvious drawback - you'll need to publish your password under version control system.
credentials += Credentials("Repository Realm", "repository.host.com", "username", "password")
- In global settings file Open (or create if not exist) file
~/.sbt/0.13/global.sbt and add to it just the same line that you would add to project sbt
- In credential file Didn't try it because previous option seemes more attractive to me. You'll need to specify path to this file in project .sbt file. You can find some clues in Publishing section of Sbt documentationand on StackOverflow