Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing to Sonatype Nexus repository doesn't work in sbt-1.0.0-x #3331

Closed
xerial opened this issue Jul 17, 2017 · 6 comments
Closed

Publishing to Sonatype Nexus repository doesn't work in sbt-1.0.0-x #3331

xerial opened this issue Jul 17, 2017 · 6 comments
Assignees
Milestone

Comments

@xerial
Copy link
Contributor

xerial commented Jul 17, 2017

steps

problem

It seems Sonatype credential configuration is not effective, and publish fails with an authentication failure:

sbt:publish-example> publish
[info] Wrote /Users/leo/work/tmp/publish-example/target/scala-2.12/publish-example_2.12-0.1-SNAPSHOT.pom

[error] java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/org/xerial/sbt/publish-example_2.12/0.1-SNAPSHOT/publish-example_2.12-0.1-SNAPSHOT.pom was refused by the server: Unauthorized

[error] 	at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:79)

[error] (*:publish) java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/org/xerial/sbt/publish-example_2.12/0.1-SNAPSHOT/publish-example_2.12-0.1-SNAPSHOT.pom was refused by the server: Unauthorized

[error] Total time: 1 s, completed Jul 17, 2017 1:50:43 PM

expectation

The same configuration works if I use sbt 0.13.x. This is a blocker for releasing https://github.com/xerial/sbt-sonatype for sbt-1.0.0-RC2.

notes

sbt version: 1.0.0-RC2

I found the configuration in ~/.sbt/1.0/*.sbt is loaded (for example, the other key set in this file can be seen in sbt console) but it seems the credential is not used when running publish command.

@dwijnand dwijnand added this to the 1.0.0-RC3 milestone Jul 17, 2017
@dwijnand
Copy link
Member

I think @marsxu1984 is running into the same issue (when trying to publish to an Artifactory repo). He reports that the same issue occurs in 1.0.0-M6, while 1.0.0-M5 works.

Start of the conversation: https://gitter.im/sbt/sbt?at=597082dabf7e6af22cf81123.

@jvican
Copy link
Member

jvican commented Jul 20, 2017

My guess is that this is due to Gigahorse.

@eed3si9n
Copy link
Member

eed3si9n commented Jul 22, 2017

I was able to reproduce it myself using an old scopt build (https://github.com/eed3si9n/scopt/tree/wip/350).
sbt/sbt dogfoods, but we use sbt-bintray so we haven't tested the publishing with authentication.

sbt:scopt> publishSigned
[info] Wrote /Users/eed3si9n/work/scopt/target/scala-2.11/scopt_2.11-3.5.0-SNAPSHOT.pom

[error] java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/com/github/scopt/scopt_2.11/3.5.0-SNAPSHOT/scopt_2.11-3.5.0-SNAPSHOT-sources.jar.asc was refused by the server: Unauthorized

[error] 	at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:79)

[error] (*:publishSigned) java.io.IOException: Access to URL https://oss.sonatype.org/content/repositories/snapshots/com/github/scopt/scopt_2.11/3.5.0-SNAPSHOT/scopt_2.11-3.5.0-SNAPSHOT-sources.jar.asc was refused by the server: Unauthorized

@xerial
Copy link
Contributor Author

xerial commented Jul 22, 2017

There are some pains in using Bintray (because its repository can be down for several hours). We also need to use private repositories (e.g., Artifactory as @marsxu1984 reported).

I'd appreciate if this bug can be fixed. (I've tried to check the corresponding code but sbt has many components, and it was difficult for me to identify the cause)

@eed3si9n
Copy link
Member

Yes. We can't ship another RC until we fix this bug.

eed3si9n added a commit to eed3si9n/librarymanagement that referenced this issue Jul 24, 2017
Fixes sbt/sbt#3331

The siatuation is a bit complicated.
Currently the credentials are stored in Ivy's credential store.
This needs to be translated into `java.net.Authenticator` by installing `IvyAuthenticator` and `ErrorMessageAuthenticator` in succession.
This, then, needs to be translated into OkHttp Authenticator using `okhttp3.JavaNetAuthenticator`.
@eed3si9n
Copy link
Member

Fixed in sbt/librarymanagement#141. This will be in next RC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants