'Why are Leiningen download dependencies in ~/.m2/repository directory?
I have created a new project using Leiningen. When I added a new dependency and ran lein deps, the lein downloaded the dependencies in ~/.m2/repository directory.
Shouldn't the project specific dependencies be downloaded in a directory that is local to the project and not into the global directory like ~/.m2/repository.
For example - While I used npm, it gave me 2 options, i.e., to download the dependency locally (in project's node_modules directory) or globally.
Solution 1:[1]
Unlike npm, lein uses maven and maven dependencies are stored in a globally shared directory, defaulting to ~/.m2/repository.
Solution 2:[2]
As previous pointed lein uses maven and maven's "local repository" is by default in the ${user.home}/.m2/repository folder.
You can control/change this from your maven (user) settings file ${user.home}/.m2/settings.xml or (global) settings file ${maven.home}/conf/settings.xml by defining the entry:
<localRepository>${user.home}/.m2/repository</localRepository>
for more details check: maven settings reference
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Michiel Borkent |
| Solution 2 | tudor |
