Leiningen 安装<转>

来源:互联网 发布:天下三女人物捏脸数据 编辑:程序博客网 时间:2024/05/21 12:43

Leiningen是一个Clojure项目管理工具。

安装过程如下:

1. 下载lein脚本

https://raw.github.com/technomancy/leiningen/preview/bin/lein

2. 复制到/usr/bin目录下,并允许执行

[plain] view plaincopyprint?
  1. mv lein /usr/bin/  
  2. root@chenshu-yangzhou-home:~/Downloads# chmod +x /usr/bin/lein   

3. 运行lein命令,不要使用root权限

[plain] view plaincopyprint?
  1.  lein  
  2. Downloading Leiningen now...  
  3. --2012-12-25 17:20:49--  https://github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar  
  4. Resolving github.com (github.com)... 207.97.227.239  
  5. Connecting to github.com (github.com)|207.97.227.239|:443... connected.  
  6. HTTP request sent, awaiting response... 302 Found  
  7. Location: http://cloud.github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar [following]  
  8. --2012-12-25 17:20:50--  http://cloud.github.com/downloads/technomancy/leiningen/leiningen-2.0.0-preview10-standalone.jar  
  9. Resolving cloud.github.com (cloud.github.com)... 216.137.55.10, 216.137.55.192, 216.137.55.57, ...  
  10. Connecting to cloud.github.com (cloud.github.com)|216.137.55.10|:80... connected.  
  11. HTTP request sent, awaiting response... 200 OK  
  12. Length: 11129174 (11M) [application/x-java-archive]  
  13. Saving to: `/home/chenshu/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar.pending'  
  14.   
  15. 100%[======================================>] 11,129,174   459K/s   in 23s       
  16.   
  17. 2012-12-25 17:21:14 (470 KB/s) - `/home/chenshu/.lein/self-installs/leiningen-2.0.0-preview10-standalone.jar.pending' saved [11129174/11129174]  
  18.   
  19. Leiningen is a tool for working with Clojure projects.  
  20.   
  21. Several tasks are available:  
  22. check               Check syntax and warn on reflection.  
  23. classpath           Write the classpath of the current project to output-file.  
  24. clean               Remove all files from project's target-path.  
  25. compile             Compile Clojure source into .class files.  
  26. deploy              Build jar and deploy to remote repository.  
  27. deps                Show details about dependencies.  
  28. do                  Higher-order task to perform other tasks in succession.  
  29. help                Display a list of tasks or help for a given task.  
  30. install             Install current project to the local repository.  
  31. jar                 Package up all the project's files into a jar file.  
  32. javac               Compile Java source files.  
  33. new                 Generate project scaffolding based on a template.  
  34. plugin              DEPRECATED. Please use the :user profile instead.  
  35. pom                 Write a pom.xml file to disk for Maven interoperability.  
  36. repl                Start a repl session either with the current project or standalone.  
  37. retest              Run only the test namespaces which failed last time around.  
  38. run                 Run the project's -main function.  
  39. search              Search remote maven repositories for matching jars.  
  40. show-profiles       List all available profiles or display one if given an argument.  
  41. test                Run the project's tests.  
  42. trampoline          Run a task without nesting the project's JVM inside Leiningen's.  
  43. uberjar             Package up the project files and all dependencies into a jar file.  
  44. upgrade             Upgrade Leiningen to specified version or latest stable.  
  45. version             Print version for Leiningen and the current JVM.  
  46. with-profile        Apply the given task with the profile(s) specified.  
  47.   
  48. Run lein help $TASK for details.  
  49.   
  50. See also: readme, faq, tutorial, news, sample, profiles,  
  51. deploying and copying.  

注意国内可能需要使用proxy才能下载,参考我的关于终端如何设置http代理的方式。

http://blog.csdn.net/sheismylife/article/details/8331287


如果因为网络原因安装失败,删除掉~/.lein目录后重新执行lein命令即可。

现在可以启动一个REPL会话,上一片里面用的是java -cp 命令,这里更简单:

[plain] view plaincopyprint?
  1. $ lein repl  
  2. nREPL server started on port 55538  
  3. REPL-y 0.1.0-beta10  
  4. Clojure 1.4.0  
  5.     Exit: Control+D or (exit) or (quit)  
  6. Commands: (user/help)  
  7.     Docs: (doc function-name-here)  
  8.           (find-doc "part-of-name-here")  
  9.   Source: (source function-name-here)  
  10.           (user/sourcery function-name-here)  
  11.  Javadoc: (javadoc java-object-or-class-here)  
  12. Examples from clojuredocs.org: [clojuredocs or cdoc]  
  13.           (user/clojuredocs name-here)  
  14.           (user/clojuredocs "ns-here" "name-here")  
  15. user=>  
输入一个lisp表达式看看:

[plain] view plaincopyprint?
  1. user=> (+ 1 2)  
  2. 3  
能够运行。注意=>左边的user代表当前的namespace.
0 0
原创粉丝点击