当常春藤缓存损坏时,如何强制sbt重新下载依赖项

ACO*_*ACO 11 sbt

当常春藤缓存损坏时,我从sbt得到以下错误

[error] unresolved dependency:commons-codec#commons-codec; 1.10:commons-codec#commons-codec中找不到的配置; 1.10:'主(编译)'.缺少配置:'compile'.它来自com.typesafe.play#play_2.11; 2.4.3编译

如果我删除常春藤缓存中的文件夹commons-codec并运行sbt update,sbt将重新下载依赖项,一切都会好的.

有没有办法告诉sbt删除文件夹并自动重新下载依赖项?

Ton*_*ser 20

这很简单,只是

rm -fr ~/.ivy2/cache # Or mv ~/.ivy2/cache ~/.ivy2/cache_bk
sbt update
Run Code Online (Sandbox Code Playgroud)

最后,如果您在Intellij,文件 - >无效缓存/重新启动.

我只是在20分钟前做了同样的事情.可能也不是坏事.我刚刚在mac上保存了一大块空间.

Atom:~ me$ du -skh ./.iv*
349M    ./.ivy2
1.0G    ./.ivy2_bak
Run Code Online (Sandbox Code Playgroud)

  • 我不能这样做:这将导致我所有的常春藤缓存重新下载。我不想浪费时间重新下载很好的依赖项。尤其是当我在旅途中连接不良时。顺便说一句,我希望 sbt 自动完成。如果非要去常春藤缓存,我可以手动删除损坏的deps。 (2认同)

Yor*_*iev 6

  # empty the ivy cache if you have good network
  # rm -rfv ~/.ivy2/cache/*

  # or even better just backup it to sync it later on ...
  # mv ~/.ivy2/cache ~/.ivy2/cache.`date "+%Y%m%d_%H%M%S`.bak


  # remove all sbt lock files
  find ~/.sbt ~/.ivy2 -name "*.lock" -print -delete
  find ~/.sbt ~/.ivy2 -name "ivydata-*.properties" -print -delete


  # remove all the class files
  rm -fvr ~/.sbt/1.0/plugins/target
  rm -fvr ~/.sbt/1.0/plugins/project/target
  rm -fvr ~/.sbt/1.0/target
  rm -fvr ~/.sbt/0.13/plugins/target
  rm -fvr ~/.sbt/0.13/plugins/project/target
  rm -fvr ~/.sbt/0.13/target
  rm -fvr ./project/target
  rm -fvr ./project/project/target

  sbt clean update
Run Code Online (Sandbox Code Playgroud)