Skip to content
Jean Niklas L'orange edited this page May 28, 2017 · 1 revision

This wiki page aims to document all the different parameter keys you can set inside an Inlein parameter map. It is currently a bit TODO-ish, feel free to add or improve onto it as you see fit!

:dependencies

:dependencies is a vector of dependency items, and works just as in Leiningen:

'{:dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/core.match "0.3.0-alpha4"]]}

(require '[clojure.core.match :refer [match]])

(doseq [n (range 1 101)]
  (println
    (match [(mod n 3) (mod n 5)]
      [0 0] "FizzBuzz"
      [0 _] "Fizz"
      [_ 0] "Buzz"
      :else n)))

If you are unfamiliar with how dependencies work in Leiningen, I would recommend looking at the documentation for dependencies for Leiningen.

:exclusions

If you want to exclude a set of dependencies which are automatically fetched, you can use :exclusions. You can, for example, replace the original Clojure version with the Jaunt fork:

'{:dependencies [[org.jaunt-lang/jaunt "1.9.0-RC4"]
                 [clj-time "0.13.0"]
                 [org.clojure/data.codec "0.1.0"]
                 [org.clojure/data.json "0.2.6"]]
  :exclusions [org.clojure/clojure]}

:jvm-opts

:jvm-opts gives you the option to tune the parameters sent to the JVM which will run the Clojure script.

'{:dependencies [[org.clojure/clojure "1.8.0"]]
  :jvm-opts ["-Dfile.encoding=UTF-8"]}

Using :jvm-opts will turn off certain default JVM options Inlein provides, which may increase startup times significantly. For more information on the default JVM options, take a look at the Faster wiki page.

:file-deps

If you have a lot of files which utilise the same startup procedure or use the same functions/dependencies, you can use :file-deps to share them:

;; file time-utils.clj
'{:dependencies [[clj-time "0.13.0"]]}

(require 'clj-time.core 'clj-time.format)

(def time-formatter (clj-time.format/formatters :date-time))
(defn print-current-time []
  (println "The time is"
    (clj-time.format/unparse time-formatter (clj-time.core/now))))
;; some other file
'{:dependencies [[org.clojure/clojure "1.8.0"]]
  :file-deps #{"time-utils.clj"}}

(println "Hello!")
(print-current-time)

All parameters are merged together if they exist, in a way that attempts to prioritise the requirement of the toplevel file. The merge algorithm is not very sophisticated, so don't attempt to do anything too clever with it.

:file-deps does not support circular dependencies, but does support transitive file dependencies and ensures the files are concatenated in the right order.

Clone this wiki locally