Access a Bintray private repository via sbt
Asked Answered
C

1

6

I would like to access a Bintray repository with credentials from sbt. I have tried the following:

resolvers += Resolver.bintrayRepo("...", "...") 

as well as,

resolvers += Resolver.url("...", url("..."))(Resolver.ivyStylePatterns) 

followed by

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

The problem arises when I try to add a library dependency from the Bintray Repository. It gives me an unresolved dependency error.

Does anyone know if there is a specific way to add library dependencies when accessing a bintray repository via sbt?

Coffin answered 1/3, 2016 at 17:58 Comment(0)
H
4

There are different credentials for publishing vs. resolving.

I have published & resolved Maven artifacts with these settings:

In project/maven.sbt:

addMavenResolverPlugin

In build.sbt:

publishMavenStyle := true

Either in build.sbt or ~/.sbt/0.13/credentials.sbt:

// publish to bintray
credentials += Credentials("Bintray API Realm", "api.bintray.com", "<user>", "<bintray API key>")

// resolve from bintray
credentials += Credentials("Bintray", "dl.bintray.com", "<user>", "<bintray API key>")

To publish with sbt publish, add this to build.sbt:

publishTo := Some("<label>" at s"https://api.bintray.com/content/<user>/<organization>/<package>/${version.value}")

Remember that this only uploads the files to bintray. Only you can resolve these files as long as you provide the credentials as shown above.

To resolve uploaded files (published or not), add this to build.sbt:

resolvers += Resolver.bintrayRepo("<user>", "<organization>")

On Bintray, you have a time limit to decide whether to discard or publish uploaded package version files.

Resolver credentials are necessary under several conditions: - the uploaded package version files have not yet been published - the uploaded package version files have been published to a private repo

Resolver credentials are not necessary for published uploaded package version files.

Heres answered 29/8, 2016 at 16:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.