Clojure project with a corporate maven repository

Sebastian Otaegui

 3 min read

Clojure is great and it has ton of features that allow developers to increase productivity. With this post we intend to show how to configure clojure to use a repository manager as proxy and how to setup the clojure project to deploy JAR files for shared usage.


Preparation (repository manager setup)

For this tutorial we are going to assume that the Nexus OSS 3 corporate repository manager is configured similar to this:

  1. Anonymous browsing disabled.

  2. The Clojars.org repository configured as a repository proxy. imageimage

  3. Add the Clojars repository to the maven public group repository. imageimage

  4. Add any extra maven repository that is needed in the same way.


Local setup ~/.lein/profiles.clj

loading
  • The line {:mirrors {#".+" {:url "https://my.local.repo/repository/maven-public/" tells leiningen to send any request to a repository that matches ".+" to the maven public group repository.

  • The line :username :env :password :env makes leingigen use the environment variables LEIN_USERNAME and LEIN_PASSWORD as authentication credentials.


Project setup lib-tools/project.clj

  • Lastly, add the section deploy-repositories to your project.clj and in order to deploy to the maven repository run lein deploy
loading
  • The output of the command should look similar to this:
loading