Reputation: 3357
I'm working on setting up some password protected dependency repositories. I'd like to clear all dependency packages and re-download to make sure the package restore is working correctly.
How should I clear the lein package cache?
Upvotes: 1
Views: 1952
Reputation: 29958
Adding to the previous answer, you can list the individual directories under ~/.m2
. For example:
~/expr/demo > d ~/.m2/repository/cl[jo]*
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clj-aws-s3/
drwxr-xr-x 5 alan alan 4096 Nov 4 21:26 /home/alan/.m2/repository/clj-commons/
drwxr-xr-x 3 alan alan 4096 Mar 30 2018 /home/alan/.m2/repository/cljfmt/
drwxr-xr-x 3 alan alan 4096 Nov 15 2017 /home/alan/.m2/repository/clj-http/
drwxr-xr-x 3 alan alan 4096 Nov 15 2017 /home/alan/.m2/repository/clj-http-lite/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-jdbcutil/
drwxr-xr-x 3 alan alan 4096 Nov 18 2017 /home/alan/.m2/repository/clj-jgit/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-liquibase/
drwxr-xr-x 3 alan alan 4096 Jun 19 2018 /home/alan/.m2/repository/clj-logging-config/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-miscutil/
drwxr-xr-x 3 alan alan 4096 Apr 25 2020 /home/alan/.m2/repository/clj-python/
drwxr-xr-x 3 alan alan 4096 Apr 1 2018 /home/alan/.m2/repository/cljs-ajax/
drwxr-xr-x 3 alan alan 4096 Mar 13 2018 /home/alan/.m2/repository/cljsbuild/
drwxr-xr-x 3 alan alan 4096 Apr 20 2019 /home/alan/.m2/repository/cljs-commons/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/cljs-http/
drwxr-xr-x 17 alan alan 4096 Jan 28 10:25 /home/alan/.m2/repository/cljsjs/
drwxr-xr-x 3 alan alan 4096 Dec 18 2019 /home/alan/.m2/repository/cljs-log/
drwxr-xr-x 3 alan alan 4096 Jan 25 2017 /home/alan/.m2/repository/clj-stacktrace/
drwxr-xr-x 3 alan alan 4096 Mar 30 2018 /home/alan/.m2/repository/cljs-tooling/
drwxr-xr-x 4 alan alan 4096 Mar 25 2019 /home/alan/.m2/repository/clj-time/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clj-tuple/
drwxr-xr-x 3 alan alan 4096 Nov 18 2017 /home/alan/.m2/repository/clj-yaml/
drwxr-xr-x 4 alan alan 4096 Jul 19 2018 /home/alan/.m2/repository/clojure/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clojure-complete/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clojure-csv/
You can then use rm -rf
on a specific subset that you wish to test (i.e. force re-download).
Upvotes: 1
Reputation: 37033
If there are no edge cases by additional plugins rm -rf ~/.m2/repository
is the brute force version -- this removes all
deps ever downloaded by Leiningen (and also Maven and maybe others).
If you want to be very specific for a certain project, you can get the
list of all actual files by lein cp
(Warning: this also contains your
source files! So you usually want the ones in ~/.m2/repository
. Of
course you use version control and have backups and therefor no problem
here...). From the list of lein cp
you would at least want to remove
the dirname
portion to kill the version, or go up two for the whole
artifact.
Upvotes: 2