EECOLOR EECOLOR - 1 year ago 132
Scala Question

How to test sbt resolvers

On my local machine I have an ivy cache that has been filled by working on multiple projects.

A library

is loaded using resolver
in project
. This same library
is used in project
, no problems resolving this library because it's in my local cache.

When one of my colleagues loads project
he get's the error that library
could not be resolved. The problem: resolver
is missing.

How can I test if my sbt project has a complete set of resolvers to resolve all dependencies without removing my ivy cache?

Answer Source

This command allows you to find if you are missing any updates for the current project. Note that this will not discover any missing resolvers for your plugins.

commands += Command.command("testUpdate") { state =>
  val base = baseDirectory.value
  val newState = Project
    .append(Seq(ivyPaths := new IvyPaths(base, Some(base / "tmp-cache"))), state)
  val (s, _) = Project
    .runTask(update, newState)

It could be expanded by removing the directory afterwards.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download