Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force lein deps to re-fetch local jars/libs

using the following instructions:

http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/

I installed some local jars into local repository.

When I want to update the jar in my project, I re-install the jar into the repository and then run lein deps. I am finding that somehow, the jar is not updated in my project. Even when I rm -rf everything in the libs folder, the new jar is not picked up. The only way I have been able to get this to work is to change the name of the jar.

Its sort of odd because this occurs even when I have deleted all traces of the old jar (as far as I know) -- does lein hide a snapshot/cache of libs?

like image 781
hiroprotagonist Avatar asked May 08 '12 18:05

hiroprotagonist


2 Answers

Leiningen uses maven for dependency management. Maven by default stores its repo in

$HOME/.m2/repository

Prior to leiningen version 2, the dependencies would be copied to <projecthome>/lib, but version 2 and later builds a classpath pointing directly to the repository.

So delete the jar in your local maven repo and you should force a (re)download.

Alternatively, it's useful to know that for snapshot dependencies, maven will only check for new versions of the snapshot once a day (by default). In maven you can force it using the -U flag. I don't think leiningen expose that, but you could do.... (but see answer from barry-wark)

# force update of snapshots before starting repl
$ lein -U repl
like image 83
sw1nn Avatar answered Nov 14 '22 16:11

sw1nn


In lein 2, you can use the -U flag, e.g.:

lein -U jar
like image 23
Barry Wark Avatar answered Nov 14 '22 16:11

Barry Wark