Skip to main content

Leiningen (Nexus Repository 2)

Nexus Repository 2

Leiningen has a built in dependency management component and defaults to the Maven repository format. As a build tool it is mostly used for projects using the Clojure language. Many libraries useful for these projects are published to the Clojars repository.

If you want use Nexus with Leiningen, first create two new Maven2 proxy repositories in Nexus with the remote URL One of these should have the Release Policy set to Release and the other should have it set to Snapshot. Then add both to your Maven 2 public group.

In order to configure a Leinigen project to resolve dependencies declared in the project.clj file, a mirrors section overriding the built in central and clojars repositories as shown in Minimal Leiningen Configuration has to be declared.

Minimal Leiningen Configuration

:mirrors {
  "central" {
    :name "Nexus"
    :url "http://localhost:8081/nexus/content/groups/public"
    :repo-manager true
  #"clojars" {
    :name "Nexus"
    :url "http://localhost:8081/nexus/content/groups/public"
    :repo-manager true}

These minimal settings allow Leiningen to download the declared dependencies.

To deploy build outputs to a Nexus repository with the deploy command, the target repositories have to be add to project.clj as deploy-repositories. This avoids Leiningen checking for dependencies in these repositories, which is not necessary, since they are already part of the Nexus public repository group used in mirrors.

:deploy-repositories [

User credentials can be declared in ~/.lein/credentials.clj.gpg or will be prompted for.

Further documentation can be found on the Leiningen website.