I have a maven repository with authentication, and I want sbt to use only the maven repository
My build.sbt:
resolvers += "My Repo" at "https://my.repository.addresss/repo/"
externalResolvers <<= resolvers map { rs =>
Resolver.withDefaultResolvers(rs, mavenCentral = false)
}
But when I type sbt clean compile
, it is still download from repo1.maven.org, I can not override it!
As my maven repo has to authenticate, so it always fails when I put default repo config in ~/.sbt/repositories
Is there any way that I can use my repo only, and authenticate successful?
Unfortunately, I can only help you with one part of your question.
If you only want to use your maven repo, have a look at the sbt documentation, chapter proxy repositories. There the file ~/.sbt/repositories is used. Alternatively, you can also use sbt.boot.properties (see Launcher configuration).
Don't forget to override the build repos from the build scripts as documented here. If you don't do that, sbt still tries to connect to repo1.maven.org.
I did the same thing today (using sbt 0.12.3), and it works!
lazy val yourRepo = "yourRepo" at "https://yourRepo.com/nexus/content/groups/public"
fullResolvers := {
val oldResolvers = fullResolvers.value
val idx = oldResolvers.map(_.isInstanceOf[DefaultMavenRepository$]).indexOf(true)
oldResolvers.take(idx) ++ Seq(yourRepo) ++ oldResolvers.drop(idx)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With