Deepak Tatyaji Ahire
Deepak Tatyaji Ahire

Reputation: 5309

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.

Upvotes: 0

Views: 215

Answers (2)

tudor
tudor

Reputation: 161

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

Upvotes: 0

Michiel Borkent
Michiel Borkent

Reputation: 34820

Unlike npm, lein uses maven and maven dependencies are stored in a globally shared directory, defaulting to ~/.m2/repository.

Upvotes: 1

Related Questions