scala - How to add an Ivy SSH repository to SBT resolvers? -
i frustrated trying add ssh ivy repository resolvers.
what have tried based on various threads on stackoverflow :
relevant part of buid.sbt
val intresolver = seq[resolver]( { import java.io.file val privatekeyfile: file = new file(sys.env("home") + "/.ssh/id_rsa") val username = sys.env("scn_user_name") resolver.ssh("int-scn-snapshot-repository", "scn.int.com")(patterns( "/export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact].[ext]", "/export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact]-[type].[ext]" ) ) as(username, privatekeyfile) withpermissions("0644") } ) resolvers ++= intresolver val exportfullresolvers = taskkey[unit]("debug resolvers") exportfullresolvers := { { (resolver,idx) <- fullresolvers.value.zipwithindex } println(s"${idx}. ${resolver.name}") } fullresolvers := { val previous = fullresolvers.value previous.sortwith { (lhs, rhs) => if (lhs.name.contains("int-scn")) true else false } }
the output of exportfullresolvers
:
> exportfullresolvers 0. int-scn-snapshot-repository 1. inter-project 2. local 3. public [success] total time: 0 s, completed jun 15, 2016 8:57:42
the output of update
:
[info] updating {file:/home/mozart/eng/ivaapbackendrd/}root... [info] resolving org.scala-lang#scala-compiler;2.10.6 ... [info] updating {file:/home/mozart/eng/ivaapbackendrd/}common... [info] resolving org.fusesource.jansi#jansi;1.4 ... [info] done updating. [info] resolving com.interactive.ivaap#ivaapwitsmldatasource;snapshot ... [warn] module not found: com.interactive.ivaap#ivaapwitsmldatasource;snapshot [warn] ==== local: tried [warn] /home/mozart/.ivy2/local/com.interactive.ivaap/ivaapwitsmldatasource/snapshot/ivys/ivy.xml [warn] ==== public: tried [warn] https://repo1.maven.org/maven2/com/interactive/ivaap/ivaapwitsmldatasource/snapshot/ivaapwitsmldatasource-snapshot.pom [info] resolving com.interactive.ivaap#ivaapcommonobjects;1 ... [warn] module not found: com.interactive.ivaap#ivaapcommonobjects;1 [warn] ==== local: tried [warn] /home/mozart/.ivy2/local/com.interactive.ivaap/ivaapcommonobjects/1/ivys/ivy.xml [warn] ==== public: tried [warn] https://repo1.maven.org/maven2/com/interactive/ivaap/ivaapcommonobjects/1/ivaapcommonobjects-1.pom [info] resolving jline#jline;2.12.1 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: unresolved dependencies :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.interactive.ivaap#ivaapwitsmldatasource;snapshot: not found [warn] :: com.interactive.ivaap#ivaapcommonobjects;1: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] note: unresolved dependencies path: [warn] com.interactive.ivaap:ivaapwitsmldatasource:snapshot (/home/mozart/eng/ivaapbackendrd/build.sbt#l68) [warn] +- com.acme:ivaap-common_2.11:0.11 [warn] com.interactive.ivaap:ivaapcommonobjects:1 (/home/mozart/eng/ivaapbackendrd/build.sbt#l68) [warn] +- com.acme:ivaap-common_2.11:0.11 [trace] stack trace suppressed: run last common/*:update full output. [error] (common/*:update) sbt.resolveexception: unresolved dependency: com.interactive.ivaap#ivaapwitsmldatasource;snapshot: not found
output of inspect:resolvers:
> inspect compile:resolvers [info] setting: scala.collection.seq[sbt.resolver] = list(sshrepository(int-scn-snapshot-repository,sshconnection(some(keyfileauthentication(mozart.brocchini,/home/mozart/.ssh/id_rsa,none)),some(scn.int.com),none),patterns(ivypatterns=wrappedarray(/export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact].[ext], /export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact]-[type].[ext]), artifactpatterns=wrappedarray(/export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact].[ext], /export/repository/maven2/snapshot/[organisation]/[module]/[revision]/[artifact]-[type].[ext]), ismavencompatible=true, descriptoroptional=false, skipconsistencycheck=false),some(0644))) [info] description: [info] user-defined additional resolvers automatically managed dependencies. [info] provided by: [info] {file:/home/mozart/eng/ivaapbackendrd/}root/*:resolvers [info] defined at: [info] /home/mozart/eng/ivaapbackendrd/build.sbt:17 [info] delegates: [info] root/compile:resolvers [info] root/*:resolvers [info] {.}/compile:resolvers [info] {.}/*:resolvers [info] */compile:resolvers [info] */*:resolvers [info] related: [info] root/*:resolvers [info] */*:resolvers
please note multi project build , dependency in question used 1 of sub projects. mean need move resolver , somehow associate subproject ?
> inspect common/update:resolvers [info] setting: scala.collection.seq[sbt.resolver] = list() [info] description: [info] user-defined additional resolvers automatically managed dependencies. [info] provided by: [info] */*:resolvers [info] defined at: [info] (sbt.classpaths) defaults.scala:1122 [info] delegates: [info] common/update:resolvers [info] common/*:resolvers [info] {.}/update:resolvers [info] {.}/*:resolvers [info] */update:resolvers [info] */*:resolvers [info] related: [info] root/*:resolvers [info] */*:resolvers >
why isn't ssh ivy repository being looked dependency resolution ?
it difficult tell question, looks added resolver resolvers in different scope compile. there several areas check:
- are adding resolver resolvers in project/plugins.sbt ?
- in sbt console check details of resolvers in project trying compile. use
inspect resolvers
command - read more scopes , understand scope adding resolvers , scope running update.
- try use
resolvers in thisbuild
instead ofresolvers
if need resolver in common module of multi-projects. can use this:
project(id = "common", base = ...) .settings( resolvers ++= intresolver )
Comments
Post a Comment