17

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?

hiroprotagonist
  • 902
  • 1
  • 11
  • 24

3 Answers3

35

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
Svante
  • 50,694
  • 11
  • 78
  • 122
sw1nn
  • 7,278
  • 1
  • 26
  • 36
13

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

lein -U jar
Barry Wark
  • 107,306
  • 24
  • 181
  • 206
0

delete .m2 folder. And it will refetch.