--- title: WindowsでLeiningen tags: [] categories: ["Programming", "Lisp", "Clojure", "Leiningen"] date: 2010-10-04T17:24:44Z updated: 2010-10-04T17:47:30Z --- **2011/09/27時点で最新の内容に修正**

知らない間にLeiningenがWindows対応していました。こちらからDL。
環境変数PATHに展開したフォルダを追加する。

C:\Users\maki>lein self-install Downloading Leiningen now... --2011-09-27 18:43:51-- https://github.com/downloads/technomancy/leiningen/lein ingen-1.5.2-standalone.jar Resolving github.com... 207.97.227.239 Connecting to github.com|207.97.227.239|:443... connected. WARNING: cannot verify github.com's certificate, issued by `/C=US/O=DigiCert Inc /OU=www.digicert.com/CN=DigiCert High Assurance EV CA-1': Unable to locally verify the issuer's authority. HTTP request sent, awaiting response... 302 Found Location: http://cloud.github.com/downloads/technomancy/leiningen/leiningen-1.5. 2-standalone.jar [following] --2011-09-27 18:43:52-- http://cloud.github.com/downloads/technomancy/leiningen /leiningen-1.5.2-standalone.jar Resolving cloud.github.com... 216.137.53.120, 216.137.53.138, 216.137.53.163, .. . Connecting to cloud.github.com|216.137.53.120|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8195550 (7.8M) [application/java-archive] Saving to: `C:/Users/maki/.lein/self-installs/leiningen-1.5.2-standalone.jar' 100%[======================================>] 8,195,550 2.30M/s in 3.6s 2011-09-27 18:43:56 (2.17 MB/s) - `C:/Users/maki/.lein/self-installs/leiningen-1 .5.2-standalone.jar' saved [8195550/8195550] C:\Users\maki>lein version Leiningen 1.5.2 on Java 1.6.0_25 Java HotSpot(TM) Client VM C:\Users\maki>lein repl REPL started; server listening on localhost:47765. user=> *clojure-version* {:major 1, :minor 2, :incremental 1, :qualifier ""} user=>

Leiningenのバージョンは1.5.2、組み込みのClojureのバージョンは1.2.1でした。これでWindowsでもClojure開発ができますね。
とりあえずHello Worldまでのっけときますね。

C:\Users\maki>lein new hello Created new project in: C:\Users\maki\hello C:\Users\maki>cd hello C:\Users\maki\hello>dir ドライブ C のボリューム ラベルがありません。 ボリューム シリアル番号は 24FA-A1A6 です C:\Users\maki\hello のディレクトリ 2011/09/27 18:48 . 2011/09/27 18:48 .. 2011/09/27 18:48 44 .gitignore 2011/09/27 18:48 126 project.clj 2011/09/27 18:48 164 README 2011/09/27 18:48 src 2011/09/27 18:48 test 3 個のファイル 334 バイト 4 個のディレクトリ 32,663,412,736 バイトの空き領域 `src/hello/core.clj`を開いて以下のように`-main`関数を定義します。 (ns hello.core) (defn -main [& args] (println "Hello World!")) `project.clj`を開いて`:main`に`-main`関数が定義されている名前空間を設定します。 (defproject hello "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.1"]] :main hello.core ) `lein run`で`-main`関数が実行されます C:\Users\maki\hello>lein run Hello World!