1
0
Fork
You've already forked leiningen
0
forked from leiningen/leiningen
Project automation for Clojure
  • Clojure 86.7%
  • Shell 4.3%
  • HTML 2.6%
  • CSS 2.2%
  • Batchfile 2.1%
  • Other 1.9%
2023年10月01日 12:07:19 -07:00
.circleci Manually set permissions of SSH signing key. 2022年11月26日 12:13:12 -08:00
.github/ISSUE_TEMPLATE Update bug_report.md 2019年02月25日 10:17:30 +13:00
bin Use XDG_CACHE_HOME instead of XDG_DATA_HOME. 2023年10月01日 12:07:19 -07:00
doc Remove doctoc mention thingy; switch to pandoc-friendly language specifier 2023年06月30日 10:10:08 -07:00
lein-pprint Update all links to point to codeberg instead of github. 2022年07月06日 21:23:16 -07:00
leiningen-core Add support for XDG config directories. 2023年09月27日 21:15:39 -07:00
resources Bump wagon-http version and nrepl version. 2022年12月06日 14:14:05 -08:00
src/leiningen Fix the fallback support for the old release plugin. 2023年10月01日 11:27:56 -07:00
test Remove test for issue with older version of gpg. 2023年03月17日 17:28:38 -07:00
test_projects Implement signing deploy artifacts using SSH keys, not just GPG. 2022年11月25日 21:08:28 -08:00
web Publish markdown documentation on leiningen.org. 2023年06月30日 10:09:45 -07:00
.gitattributes Added .gitattributes to avoid autocrlf for bat files 2010年12月31日 22:22:56 -08:00
.gitignore Publish markdown documentation on leiningen.org. 2023年06月30日 10:09:45 -07:00
.woodpecker.yml The bin/notify script doesn't actually work in CI, of course. 2022年11月25日 21:58:25 -08:00
bash_completion.bash Remove 'swank' and add missing commands to bash completion. 2016年06月03日 12:06:39 -07:00
CONTRIBUTING.md Use XDG_CACHE_HOME instead of XDG_DATA_HOME. 2023年10月01日 12:07:19 -07:00
COPYING tocontrol -> to control in LICENSE files 2016年07月23日 01:06:19 +03:00
NEWS.md Use XDG_CACHE_HOME instead of XDG_DATA_HOME. 2023年10月01日 12:07:19 -07:00
pcmpl-lein.el Clarify that pcmpl-lein.el is not part of Leiningen. 2013年05月17日 13:46:44 -07:00
project.clj Bump version to 2.10.1-SNAPSHOT. 2022年12月09日 10:50:27 -08:00
README.md Update docs to point to wiki.leiningen.org. 2023年02月04日 11:11:57 -08:00
sample.project.clj Add sample section about :repl-options :history-file 2023年05月15日 20:26:07 +02:00
zsh_completion.zsh Check if in a lein project before ns completion 2014年08月18日 13:26:53 -05:00

Leiningen

status-badge

Leiningen logo

"Leiningen!" he shouted. "You're insane! They're not creatures you can fight—they're an elemental—an 'act of God!' Ten miles long, two miles wide—ants, nothing but ants! And every single one of them a fiend from hell..."

Leiningen is for automating Clojure projects without setting your hair on fire.

Note: the canonical repository for Leiningen is on Codeberg but we maintain a mirror on GitHub for the time being in order to ease the transition. Please update your links and git remotes.

Installation

If your preferred package manager offers a recent version of Leiningen, try that first.

Leiningen installs itself on the first run of the lein shell script; there is no separate install script. Follow these instructions to install Leiningen manually:

  1. Make sure you have Java installed; OpenJDK is recommended
  2. Download the lein script from the stable branch of this project
  3. Place it on your $PATH (/usr/local/bin for example)
  4. Set it to be executable. (sudo chmod +x /usr/local/bin/lein)
  5. Run it.

Windows users can use the above script in the Linux subsystem or try the batch file or Powershell version instead.

Basic Usage

The tutorial has a detailed walk-through of the steps involved in creating a new project, but here are the commonly-used tasks:

$ 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 deploy clojars # publish the project to Clojars as a library

Use lein help to see a complete list. lein help $TASK shows the usage for a specific task.

You can also chain tasks together in a single command by using the do task with comma-separated tasks:

$ lein do clean, test foo.test-core, jar

Most tasks need to be run from somewhere inside a project directory to work, but some (new, help, search, version, and repl) may run from anywhere.

Configuration

The project.clj file in the project root should look like this:

(defproject myproject "0.5.0-SNAPSHOT"
 :description "A project for doing things."
 :license "Eclipse Public License 1.0"
 :url "http://codelab.org/technomancy/myproject"
 :dependencies [[org.clojure/clojure "1.8.0"]]
 :plugins [[lein-tar "3.2.0"]])

The lein new task generates a project skeleton with an appropriate starting point from which you can work. See the sample.project.clj file (also available via lein help sample) for a detailed listing of configuration options.

The project.clj file can be customized further with the use of profiles.

Documentation

Leiningen documentation is organized as a number of guides:

Usage

Development

Plugins

Leiningen supports plugins which may introduce new tasks. See the plugins wiki page for a full list. If a plugin is needed for successful test or build runs, (such as lein-tar) then it should be added to :plugins in project.clj, but if it's for your own convenience (such as lein-pprint) then it should be added to the :plugins list in the :user profile in ~/.lein/profiles.clj. See the profiles guide for details on how to add to your :user profile. The plugin guide explains how to write plugins.

License

Source Copyright © 2009-2022 Phil Hagelberg, Alex Osborne, Dan Larkin, and contributors. Distributed under the Eclipse Public License, the same as Clojure uses. See the file COPYING.

Thanks to Stuart Halloway for Lancet and Tim Dysinger for convincing me that good builds are important.

Images Copyright © 2010 Phil Hagelberg. Distributed under the Creative Commons Attribution + ShareAlike License 4.0. Full-size version available.