Os:mac OS X 10.10
Idea 14.0.2 Community Edition
Installing Leiningen
Follow http://leiningen.org/'s Guide to install Lein
Read Leiningen tutorial Chinese version to learn about Leiningen
If you need to use a proxy, you need to perform
Export Https_proxy=host:port
Export Http_proxy=host:port
(When executing Lein deps, if you also need to use a proxy, export https_proxy and export http_proxy)
Installing La Clojure
Install the idea plugin La Clojure. After the idea, point to the top left corner of IntelliJ idea, choose Preferences, then choose Plugins on the left, click Browse Repositories, search Clojure, download La Clojure.
New Project
Establish Clojure project under the workspace. Enter Lein new Groupid/artifactid. GroupID and Artifactid in the same concept as Maven.
For example, if I enter Lein new Hs.clojure/learn, I will build a clojure project according to the template.
Import idea
This project directly into idea will not be recognized correctly, so you need to execute the Lein pom in the Learn directory and generate the corresponding POM.
Then import project in idea, select Import project from external model, and then point to Maven, all the way down.
Configure the main function
In the open Idea Project, open the SRC directory with the Learn.clj file in the Hs.clojure package.
There is no main function in this Clojure file, so run is executed in idea and nothing is output.
Change the contents of this file.
(NS Hs.clojure.learn) (Defn-main [& args] (println "Hello, world!"))
Then click Run in the top menu of idea, select Edit configurations, select Run main function in the script namespace, click OK.
Execute run "Learn" in the Run menu and the program will print "Hello, world!".
At this point, if you execute Lein run, you will say "No:main namespace specified in Project.clj".
Need to modify PROJECT.CLJ
(Defproject hs.clojure/learn "0.1.0-snapshot" : Main hs.clojure.learn :d ependencies [[Org.clojure/clojure] 1.6.0 "])
After saving, execute Lein run, output "Hello, world!"
Build clojure development environment-use idea and Leiningen