工欲善其事,必先利其器之—MAC下搭建clojure的开发环境

前置环境

安装JDK

安装clojure sdk

尝试使用homebew来安装clojure SDK

brew install clojure
luogw@luogw-MacBook-Pro notes$ brew install clojure
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
docfx

==> Downloading https://download.clojure.org/install/clojure-tools-1.9.0.381.tar.gz

curl: (35) Server aborted the SSL handshake
Error: Failed to download resource "clojure"
Download failed: https://download.clojure.org/install/clojure-tools-1.9.0.381.tar.gz

网络有问题,安装失败,那就下载源码并编译吧
如下是网官的指引

git clone https://github.com/clojure/clojure.git
cd clojure
./antsetup.sh
# 编译clojure SDK
ant local

clone源码后,执行antsetup.sh遇到如下问题(代码cloen的目录在/Users/luogw/dev_tool/clojure)

luogw@luogw-MacBook-Pro clojure$ ./antsetup.sh
./antsetup.sh: line 3: mvn: command not found
cat: maven-classpath: No such file or directory
cat: maven-classpath: No such file or directory
Wrote maven-classpath.properties for standalone ant use

出错提示没有安装mvn
安装mvn还有ant(注:后面编译clojure时需要ant的!)

 brew install maven
 brew install ant

编译成功后,目录下有clojure.jar
在.bash_profile里添加如下配置

# for clojure
alias start_clojure='java -jar /Users/luogw/dev_tool/clojure/clojure.jar'

命令行的开发环境

进入clojure 的REPL交互模式(运行前面添加的start_clojure命令 ),直接写clojure脚本

luogw@luogw-MacBook-Pro temp$ source  ~/.bash_profile
luogw@luogw-MacBook-Pro temp$ start_clojure
Clojure 1.10.0-master-SNAPSHOT
user=> println "hello, clojure"
#object[clojure.core$println 0x2ef14fe "clojure.core$println@2ef14fe"]
"hello, clojure"
user=>

IDE下的开发环境

IDEA的开发环境

TODO

插件安装

创建工程

编码运行

交互式RELP模式

在线的编译运行环境

https://repl.it/repls/BlueBountifulOpposites

参考资料

猜你喜欢

转载自blog.csdn.net/SCHOLAR_II/article/details/80861094