Leiningen是一个命令行工具,用来解决Clojure项目的包管理、依赖、打包、部署等问题。
安装
1.Download the lein script (or on Windows lein.bat)
2.Place it on your $PATH where your shell can find it (eg. ~/bin)
3.Set it to be executable (chmod a+x ~/bin/lein)
4.Run it (lein) and it will download the self-install package.
You can check your package manager as well, but be sure you get version 2.x. There's also an installer for Windows users.
lein --version
Leiningen 2.5.0 on Java 1.8.0_20 Java HotSpot(TM) 64-Bit Server VM
lein -h
Leiningen is a tool for working with Clojure projects.
Several tasks are available:
change Rewrite project.clj by applying a function.
check Check syntax and warn on reflection.
classpath Print the classpath of the current project.
clean Remove all files from project's target-path.
compile Compile Clojure source into .class files.
deploy Build and deploy jar to remote repository.
deps Download all dependencies.
do Higher-order task to perform other tasks in succession.
exec Execute Clojure S-expresions from command-line or scripts.
help Display a list of tasks or help for a given task.
install Install the current project to the local repository.
jar Package up all the project's files into a jar file.
javac Compile Java source files.
midje Runs both Midje and clojure.test tests.
new Generate project scaffolding based on a template.
plugin DEPRECATED. Please use the :user profile instead.
pom Write a pom.xml file to disk for Maven interoperability.
release Perform :release-tasks.
repl Start a repl session either with the current project or standalone.
retest Run only the test namespaces which failed last time around.
ritz Launch ritz server for Emacs to connect.
ritz-hornetq Start a nrepl session over HornetQ.
ritz-in Jack in to a ritz backed Clojure SLIME session from Emacs.
ritz-nrepl Start a nrepl session either with the current project or standalone.
run Run a -main function with optional command-line arguments.
search Search remote maven repositories for matching jars.
show-profiles List all available profiles or display one if given an argument.
test Run the project's tests.
trampoline Run a task without nesting the project's JVM inside Leiningen's.
uberjar Package up the project files and dependencies into a jar file.
update-in Perform arbitrary transformations on your project map.
upgrade Upgrade Leiningen to specified version or latest stable.
vcs Interact with the version control system.
version Print version for Leiningen and the current JVM.
with-profile Apply the given task with the profile(s) specified.
新建项目
lein new project
下载依赖库
lein deps
lein uberjar
生成jar包
lein uberjar
生成 maven 的 pom.xml文件
lein pom
测试
lein test (namespace)
导入工程到IDEA
先 lein pom
然后 idea -> import project -> 选择 pom.xml