Search code examples
mavenjarclojureleiningen

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?


Solution

  • 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