Thursday, April 9, 2015

Clojure command line script with dependencies

If you want to use Clojure for command line scripts, the easiest way is by using lein-exec plugin. It compiles clj files on the fly and downloads all necessary dependencies that are declared in same file, similarly to Groovy @Grab annotation.

For example, if you have file named download.clj with
(leiningen.exec/deps '[[http-kit "2.1.16"]])
(require '[org.httpkit.client :as http])

(prn (:body @(http/get "")))

it is possible to run it by:
lein exec download.clj

1 comment:

  1. The 7 Best Casino Games in San Diego 2021 - Mapyro
    The 울산광역 출장샵 7 Best 진주 출장마사지 Casino 포천 출장샵 Games in San Diego 2021 아산 출장샵 · 1. Hard Rock Hotel & Casino, 777 Casino Dr, Downtown, 김포 출장마사지 CA, 92082.