How to install a leiningen plugin?

后端 未结 2 801
南方客
南方客 2021-02-07 05:13

How do I install a leiningen plugin?

For example, leiningen-run?

I see this thing called \"clojars.org\", and how to \"push\" to it, but I don\'t see anything ab

2条回答
  •  清歌不尽
    2021-02-07 05:38

    Depending on a plugin

    With Leiningen 2.0 and greater you specify which plugins you want as values to :plugins in your project map. See the sample project.clj file. Note that "sample" is a bit of a misnomer, it's a reference for all possible (built-in) keys and documentation of their defaults.

    lein-run

    The lein-run functionality is now part of core leiningen and doesn't need to be specified as a plugin

    clojars.org

    Clojars is a repository of clojure libraries quite similar to maven central (or to some lesser extent, rubygems). You don't pull from it explicitly. Instead, Leiningen is configured to search through a standard set of repos for your :dependencies E.g. maven central and clojars. Maven uniquely identifies its dependencies (artifacts in maven parlance) by a triple (group-name, artifact-name, version). Leiningen leverages the exact same mechanism with the exception that the group name does not have the restriction of being a reverse URI the way it must be with maven central. In practice you'll tend to see many libraries published in clojars where the name nicely matches the clojure namespace and github project name without the annoying com.mydomain.awesomelib

    You can set your own repos to be searched (or tweak various options) via :repositories in you project.clj. You can similarly set :mirrors if you have an in-house mirror of a maven repo.

    "Installing" an unpublished plugin

    Finally, though I don't think that's directly what you were asking but it's still interesting, If you're developing a plugin or what to depend on a plugin that hasn't been officially published, you can set :plugin-repositories

提交回复
热议问题