Most of this information is cribbed from the awesome website/blog below
https://www.baeldung.com/leiningen-clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Once you have lein installed, check its working with $ lein Leiningen is a tool for working with Clojure projects. Several tasks are available: change Rewrite project.clj with f applied to the value at key-or-path. check Check syntax and warn on reflection. classpath Write the classpath of the current project to output-file. : : These aliases are available: downgrade, expands to upgrade See also: readme, faq, tutorial, news, sample, profiles, deploying, gpg, mixed-source, templates, and copying. |
1 2 3 4 5 6 7 8 9 10 | # Create a new project $ ./lein new app my-project Generating a project called my-project based on the 'app' template. # Available templates are # app – Used to create an application # default – Used to create a general project structure, typically for libraries # plugin – Used to create a Leiningen Plugin # template – Used to create new Leiningen templates for future projects |
1 2 3 4 5 6 7 8 9 10 11 12 | ;; project.clj (defproject my-app "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :url "https://www.eclipse.org/legal/epl-2.0/"} :dependencies [[org.clojure/clojure "1.11.1"]] :main ^:skip-aot my-app.core :target-path "target/%s" :profiles {:uberjar {:aot :all :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}}) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Launch a REPL lein repl nREPL server started on port 62856 on host 127.0.0.1 - nrepl://127.0.0.1:62856 []REPL-y 0.4.3, nREPL 0.5.3 Clojure 1.9.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_77-b03 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e |
1 2 3 4 5 | # Run Hello World my-project.core=> (-main) Hello, World! nil |
1 2 3 4 | # Run your application % lein run Hello, World! |