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:
- the settings need part of build declaration (either .sbt or .scala, not in "global" sbt settings
- if dependency exists in local repository, should taken there. don't want have access network dependencies every build.
- 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
Post a Comment