Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leiningen compile does nothing

(leiningen v 2.5.1)

Leiningen compile seems to be doing absolutely nothing, even with a new project. My steps are

lein new default foo
cd foo
lein compile
ls | grep target            # nada
lein jar                    # does create a target, but with an empty .jar.  Still no .class files

EDIT

I also tried with the :all :aot flags, still no dice.

What next?

like image 896
Roy Truelove Avatar asked Oct 31 '25 12:10

Roy Truelove


2 Answers

You need to add :aot :all into your project.clj (Note, you have it vice-versa in your edit). After that compile task will compile all your namespaces. You can also name only those namespaces you want to compile.

As a side note, also in resulting jar the Clojure namespaces does not need to be in compiled form. This is the role of :aot key to control which namespaces will get compiled.

like image 178
Martin Avatar answered Nov 04 '25 20:11

Martin


Have a look in your project.clj file. You will see there is very little there. The lein command your using to setup the project is a bare minimum definition. It has very little in it. You might do better with the 'app' template to start with. You also need to look at the lein documentation to see what goes into the project.clj file. Google for some lein templates to see what other templates are available. I would then select one and an initial simple project to play with.

Note that you don't need to run lein compile to just get started with clojure and writing some codes/expressions to play with - run lein repl instead.

like image 25
Tim X Avatar answered Nov 04 '25 21:11

Tim X



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!