Steve B.
Steve B.

Reputation: 57333

Clojure and lein

Are there some useful ways of triggering complete rebuilds in lein? I'm finding it hard to understand how / when lein reruns/reloads code. Altering files doesn't always seems to result in the changes being applied, and manually requesting recompile for gen-class doesn't always seem to generate files.

Manually deleting files in the target directory doesn't always work, as even if I recompile those files are not always generated so I'll get ClassNotFound errors. How do I have lein properly rebuild everything on each invocation?

edit: most of my confusion was due to not specifying classes created with gen-class in the project.clj file with an :aot directive as suggested in @juan.facorro's comment, e.g.

(defproject 
     ...
      :aot [mytestclass.full.packagename.TestClass1 mytestclass.full.packagename.TestClass2 ]
     ...
    )

Upvotes: 1

Views: 579

Answers (1)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

This sounds like part of a bigger issue: making the clojure development cycle shorter. Once you have your project running happily in the REPL (and this is the first goal) there are several things thats can really drag down the development speed. Changing protocol deffinitions for instance requires you to hunt down and reload every namespace that has instances of that protocol. Stewart Sierra made a great project, gave a presentation and interview about how to set up your project and process so everything that needs reloading is reloaded as quickly as possible.

Upvotes: 1

Related Questions