sbt: publish to corporate Nexus repository unauthorized

前端 未结 2 1983
有刺的猬
有刺的猬 2021-01-30 23:46

Quick resolution

The required credential expects the exact realm as defined by nexus. See below how to find the one you have defined, but most certainly

相关标签:
2条回答
  • 2021-01-30 23:50

    Ivy uses the realm of the WWW-Authenticate header, which will have to match byte-for-byte equal to the one configured in your credentials file.

    sbt-aether-deploy uses the same header, but uses Aether as its deployment mechanism. Ivy does not.

    The easiest way of figuring out the value of the WWW-Authenticate header is by using cURL.

    curl -X POST http://nexus/content/repositories/libs-snapshots -v > /dev/null
    

    cURL will prompt you for a user and pass.

    -v will add verbosity so you will be able to see the headers of the request and response.

    0 讨论(0)
  • 2021-01-31 00:07

    I suspect that your credentials file path may be incorrect. Try changing this:

    credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
    

    to that:

    credentials += Credentials("c:/data/user/.sbt/.credentials")
    

    or try directly to troubleshoot first:

    credentials += Credentials("Sonatype Nexus Repository Manager", 
      "nexus.scala-tools.org", "admin", "admin123") 
    

    If these don't work check that your credentials are valid.

    0 讨论(0)
提交回复
热议问题