Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a leiningen plugin?

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 about "pulling" from it.

like image 209
kes Avatar asked Mar 06 '10 18:03

kes


People also ask

What is Clojure Leiningen?

Leiningen is a modern build system for our Clojure projects. It's also written and configured entirely in Clojure. It works similarly to Maven, giving us a declarative configuration that describes our project, without needing to configure exact steps to be executed.

Does Leiningen install Clojure?

Most Clojure projects are still built using Leiningen.

What is Lein DEPS?

The goal of the "deps" target is to ensure that every dependency required to run this project is available in your local maven repo. In short it populates ~/.m2/... with jars that need to be on the class-path for the project to run. If lein finds the dependency, which is the required version of a project, in ~/.


1 Answers

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

like image 199
strangemonad Avatar answered Oct 14 '22 17:10

strangemonad