How to configure Ivy cache directory per-user or system-wide?

前端 未结 7 1147
说谎
说谎 2020-12-02 09:38

I am using SBT as my build tool for building a Scala project.

My problem is, I can\'t configure SBT to download dependencies to my user home directory. Therefore I a

7条回答
  •  广开言路
    2020-12-02 09:47

    You can retrieve your home directory using Path.userHome.absolutePath, like shown below:

    resolvers += Resolver.file("Local", file( Path.userHome.absolutePath + "/.ivy2/local"))(Resolver.ivyStylePatterns)
    

    I suppose that you can also retrieve environment variables using System.getenv and concatenate in the same way, like shown below:

    resolvers += Resolver.file("Local", file( System.getenv("IVY_HOME") + "/whatever/it/is"))(Resolver.ivyStylePatterns)
    

提交回复
热议问题