通过 leiningen 安装 Clojure 的简单步骤

leinningen 是基于 Clojure 的项目管理工具,可以通过 leningen 简单地安装 Clojure,具体步骤如下:

1、在自己的电脑商新建一个目录,目录名为 Clojure

2、从 leninggen 的 github 下载 lein.sh 脚本,拷贝到 Clojure 目录下,执行 chmod 755 ./lein.sh 修改为可执行

3、从终端窗口执行命令 ./lein.sh repl ,如下:

Air:Clojure admin$ ./lein.sh repl
Downloading Leiningen to /Users/admin/.lein/self-installs/leiningen-2.3.4-standalone.jar now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.0M  100 13.0M    0     0   133k      0  0:01:39  0:01:39 --:--:--  225k
Retrieving org/clojure/tools.nrepl/0.2.3/tools.nrepl-0.2.3.pom from central
Retrieving org/clojure/pom.contrib/0.1.2/pom.contrib-0.1.2.pom from central
Retrieving org/sonatype/oss/oss-parent/7/oss-parent-7.pom from central
Retrieving clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.pom from clojars
Retrieving org/clojure/tools.nrepl/0.2.3/tools.nrepl-0.2.3.jar from central
Retrieving clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar from clojars
nREPL server started on port 62912 on host 127.0.0.1
REPL-y 0.3.0
Clojure 1.5.1
    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

user=> (* 2 4)
8
user=>



这样就可以了。

lein 有如下命令参数:

$ lein new [TEMPLATE] NAME # generate a new project skeleton

$ lein test [TESTS] # run the tests in the TESTS namespaces, or all tests

$ lein repl # launch an interactive REPL session

$ lein run -m my.namespace # run the -main function of a namespace

$ lein uberjar # package the project and dependencies as standalone jar

或者可以输入 lein help 获得更全面的帮助说明。

你可能感兴趣的:(clojure,lein,leiningen)