Freewind
Freewind

Reputation: 198188

How to add some local maven repo url to global sbt, and make them be tried first?

I want to add some fast local maven repository url to sbt, say:

http://maven.example.com/public

I want to add it to "global", so that I don't need to add them to each of sbt project. And also want to be tried first when sbt downloading some jars.

But I can't find useful information to do this, how to do it?

(My sbt version is 0.13.1)

Upvotes: 3

Views: 2521

Answers (2)

lpiepiora
lpiepiora

Reputation: 13749

Modify your global configuration file, which is normally located in ~/.sbt/0.13/global.sbt, if it's not there you can create it.

In the file add following line:

externalResolvers := { ("Fast Repo" at "http://maven.example.com/public") +: externalResolvers.value }

You can confirm it's working by executing show externalResolvers in any project to see the list of resolvers. Your newly added resolver should be first.

Upvotes: 2

Freewind
Freewind

Reputation: 198188

With the help of a friend, finally I found the solution:

  1. create a new file ~/.sbt/repositories

  2. add content like this:

    [repositories]
    local
    my-maven-repo: http://example.org/repo
    my-ivy-repo: http://example.org/ivy-repo/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
    

See official doc: http://www.scala-sbt.org/0.13.2/docs/Detailed-Topics/Library-Management.html#override-all-resolvers-for-all-builds

Upvotes: 7

Related Questions