jcrossley3 / lein-modules

An alternative to Maven multi-module projects in Leiningen
Eclipse Public License 1.0
83 stars 17 forks source link

Create checkouts in module directories #7

Closed mtnygard closed 10 years ago

mtnygard commented 10 years ago

When one module in a project depends on another module in the same project, we are faced with a chicken-and-egg problem. The first time you run a task such as 'lein modules test', it will fail due to missing jars in the local repository. (This will apply to the first clean build on a new version number.)

Suppose module B depends on module A. Running 'lein test' in module B will silently use the last version of module A that was installed to a visible repository (local, declared, or central.)

Likewise, when running a REPL within a module, we will get a version that doesn't match the checkout in the dev environment.

Lein has a solution in the form of "checkouts". So we could do the following:

~/proj/module-b/project.clj (declares dependency on module-a)
~/proj/module-b/checkouts/module-a (symlink to ~/proj/module-a)
~/proj/module-a/project.clj (as normal)

It would be great if lein-modules could create the checkouts directories and symlinks for us. Since it already knows the dependency structure, and has a survey of which modules are inside the codebase, it is well-positioned to maintain to do the tedious bookkeeping for those symlinks.

jcrossley3 commented 10 years ago

Hi Michael. I like the idea. Although I'm aware of "checkouts", I've never used them. Having to run 'lein modules install' from the root after pulling changes is analogous to running 'mvn install' from the root of a Maven project. I guess it's Stockholm syndrome for me at this point. Similarly, I just naturally run 'lein install' when I change module A to make 'lein test' work in module B.

But I agree the REPL makes that workflow sucky. I'm happy to look into automatically creating the checkouts and symlinks to make that easier.

Btw, I know lein-voom makes much use of checkouts. Have you looked at it?

mtnygard commented 10 years ago

I just took a look at lein-voom. It's ambitious. I think it would impose more constraints on my workflow than I'm looking for at the moment.

jcrossley3 commented 10 years ago

With version 0.2.5, you should be able to run lein modules :checkouts to create all the symlinks. Thanks for the suggestion!