question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authentication to private repository using SBT credentials not working

See original GitHub issue

I have SBT credentials installed in ~/.sbt/0.13/plugins/credentials.sbt in the form:

credentials += Credentials("Sonatype Nexus Repository Manager",
                           "nexus.example.com",
                           "user",
                           "pass")

SBT resolves private artifacts from my company’s Nexus just fine. I switched to Coursier (added addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14") to my plugin definitions), and I added the line

coursierUseSbtCredentials := true

as suggested by the documentation this should use the SBT credentials, but when resolving I always get

[error]     unauthorized: https://nexus.example.com....

Is there something I’m missing? Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:21 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
2mcommented, Nov 12, 2016

I ended up not using coursierUseSbtCredentials. Instead I set credentials to every resolver via the coursierCredentials key.

2reactions
2mcommented, Nov 8, 2016

Ran into the same issue and tried using coursierUseSbtCredentials but that ended up with a bunch of coursier.ResolutionException: 6 locked exceptions.

So I ended up specifying credentials specifically for coursier in my ~/.sbt/0.13/global.sbt like so:

coursier.Keys.coursierCredentials ++= Seq(
  "<resolverName>" -> coursier.Credentials.Direct("<username>", "<password>")
).toMap

You can list out all the names of the resolvers used in your build by running:

➜ sbt
> consoleProject
scala> resolvers.eval.map(_.name)
Read more comments on GitHub >

github_iconTop Results From Across the Web

SBT is unable to find credentials when attempting to download ...
For authenticating dependency artifact retrieval, create a file like %USERPROFILE%/.sbt/0.13/plugins/my-credentials.sbt with a credentials ...
Read more >
sbt Repository - Cloudsmith Help
sbt /.credentials file (required for private repositories if using HTTP Basic Authentication), all that is left is to specify the dependency in the...
Read more >
Add support for SBT authentication (#11273) · Issues - GitLab
The documentation appears to state that the only acceptable form of authentication is with a username and password. My team is dealing with...
Read more >
sbt Reference Manual — Publishing
To use publishing, you need to specify the repository to publish to and the credentials to use. Once these are set up, you...
Read more >
sbt-github-packages - Scaladex
Please, for the love of all that is holy, do not check this into your repository if you hard-code your credentials in this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found