5

I am using a local maven repository to house some code I am using to develop a project. I have cited this repository in my project.clj file, and am now able to rely on local jars in this way (how to do this in a previous question of mine).

Since I am actively developing these projects, I have my project.clj file looking for the LATEST version. But, in order to update a dependency, I still have to increment the version number of that dependency and then run lein install to build it to the maven repository.

Does leiningen have a way to do this where this is automatically done for me when I build the project that depends on things from the maven repo? Can lein just look for those things and rebuild them as needed?

Community
  • 1
  • 1
benekastah
  • 5,651
  • 1
  • 35
  • 50
  • duplicate of this [http://stackoverflow.com/questions/5693621/keeping-dependency-versions-up-to-date-in-leiningen-projects]..? – Abimaran Kugathasan Dec 07 '11 at 07:41
  • I actually looked at that question before I posted. It gave me part of my answer (using "LATEST" as my version string -- which actually hasn't worked, don't know why yet). However, I am thinking more along the lines of lein automatically picking up on code changes of local projects or even compiling local projects on the fly as they are used. – benekastah Dec 07 '11 at 07:53

2 Answers2

8

If you want to develop two projects in parallel, with one depending on the other, you can use symlinks in a checkouts directory to avoid having to install snapshots all the time.

To quote from the Leiningen README:

Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: Use a feature called checkout dependencies. If you create a directory called checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. That means changes in the dependency will be visible in the main project without having to go through the whole install/switch-projects/deps/restart-repl cycle. Note that this is not a replacement for listing the project in :dependencies; it simply supplements that for tighter change cycles.

Christian Berg
  • 14,246
  • 9
  • 39
  • 44
  • This looks like exactly what I need. The only think is I'm still unsure how to cite the dependency in the project file. Do I need to simply use `"LATEST"` as the version, and then it will load all code changes in next time I run the project? How does that aspect work? – benekastah Dec 08 '11 at 03:04
  • For anyone interested in my questions in the above comment, @Christian Berg goes into more detail [here](http://stackoverflow.com/a/8434053/777929). Thanks, Christian! – benekastah Dec 08 '11 at 16:35
  • You're welcome! I had to dig around in the Leiningen source code to learn this... – Christian Berg Dec 08 '11 at 16:40
0

Are your dependencies version snapshots? Maven should update all *-SNAPSHOT dependencies on build automatically.

Mikita Belahlazau
  • 15,326
  • 2
  • 38
  • 43