如何更改IntelliJ中捆绑sbt的coursier缓存目录



我已将本地coursier缓存迁移到系统的另一部分,并更改了COURSIER_CACHE系统属性,如coursier文档中所述

我在本地安装的SBT可以通过shell和IntelliJ的SBT shell正常工作。然而,当使用CTRL+F9在SBT中使用IntelliJ的构建构建我的应用程序时,我得到了以下错误:

scalac: Scala compiler JARs not found (module 'solipsism'): C:Users<user>AppDataLocalCoursiercachev1httpsrepo1.maven.orgmaven2orgscala-langscala-library2.13.5scala-library-2.13.5.jar, <etc>

其中CCD_ 2是默认的档案缓存位置。

到目前为止,我尝试将以下VM参数添加到
Settings>生成执行部署>sbt>VM参数
失败:

-Dcoursier.cache=<repo dir>
-Dsbt.coursier.home=<repo dir>

如SBT文件和档案文件中所述

使用csrCacheDirectory通过IntelliJ的SBT shell验证这些设置表明它们是正确获取的,但生成错误仍然存在。

如何更改默认版本的档案缓存目录?

使用Windows 10、IntelliJ CE 2021.1.1、SBT 1.5.1

谢谢,

干杯,Joost Papendorp

找到原因:IntelliJ以某种方式在项目结构中保留了到旧存储库的链接。这显然不是通过重新导入项目来解决的。

解决方案:删除整个Intellij项目(而不仅仅是模块(。关闭IDE。启动新项目。重新导入模块。

优雅。

https://get-coursier.io/docs/cache#sbtd提到两个选项:

  1. -Dsbt.coursier.home系统属性,或
  2. COURSIER_CACHE环境变量

最新更新