Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access a Bintray private repository via sbt

Tags:

sbt

bintray

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?

like image 711
ciwood Avatar asked Mar 01 '16 17:03

ciwood


Video Answer


1 Answers

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.

like image 140
Nicolas Rouquette Avatar answered Nov 11 '22 06:11

Nicolas Rouquette