SBT runs dependency resolution every time after clean
even if project dependency management configuration hasn't changed. This is time consuming when running on CI server.
But documentation says:
- Normally, if no dependency management configuration has changed since the last successful resolution and the retrieved files are still
present, sbt does not ask Ivy to perform resolution.
How can I stop sbt from doing dependency resolution every time I build project with sbt clean publish-local
?
Update
I've discovered that sbt also runs resolution when I enter in interactive mode with sbt
.
Update2
As @Ezhik
pointed if I can preserve target/resolution-cache
then sbt will not resolve dependencies after clean.
So I tried to move resolution-cache
out from target dir:
ivyConfiguration <<= (externalResolvers, ivyPaths, offline, checksums, appConfiguration, target, streams) map { (rs, paths, off, check, app, t, s) =>
val resCacheDir = t / ".." / "resolution-cache"
new InlineIvyConfiguration(paths, rs, Nil, Nil, off, Option(lock(app)), check, Some(resCacheDir), s.log)
}
Now with this code in Build.scala
resolution cache is placed in project root and is therefore preserved after clean
, but resolution is being done anyway. So I assume this approach is wrong or insufficient.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…