sbt - How do I add a Nexus resolver after local repository, but before the default repositories? -


we have internal nexus repository use publish artifacts , cache external dependencies (from maven central, typesafe, etc.)

i want add repository resolver in sbt build, under following restrictions:

  1. the settings need part of build declaration (either .sbt or .scala, not in "global" sbt settings
  2. if dependency exists in local repository, should taken there. don't want have access network dependencies every build.
  3. if dependency doesn't exist locally, sbt should first try nexus repository before trying external repositories.

i saw several similar questions here, didn't find solution this. specifically, code have is:

externalresolvers ~= { rs => nexusresolver +: rs } 

but when show externalresolvers nexus repo appears before local one.

so far, i've come following solution:

externalresolvers ~= { rs =>   val grouped = rs.groupby(_.isinstanceof[filerepository])   val filerepos = grouped(true)   val remoterepos = grouped(false)   filerepos ++ (nexusresolver +: remoterepos) } 

it works, kinda dirty... if has "cleaner" solution, i'd love hear it.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -