Clojure project with a corporate maven repository
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:
-
Anonymous browsing disabled.
-
The Clojars.org repository configured as a repository proxy. image
-
Add the Clojars repository to the maven public group repository. image
-
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 variablesLEIN_USERNAME
andLEIN_PASSWORD
as authentication credentials.
Project setup lib-tools/project.clj
- Lastly, add the section
deploy-repositories
to yourproject.clj
and in order to deploy to the maven repository runlein deploy
- The output of the command should look similar to this: