Skip to content
Daniel Compton edited this page Jan 13, 2020 · 16 revisions

Running an internal proxy or mirror of Clojars

If you or your company is mirroring, proxying, or otherwise depends on Clojars (including for CI/CD), it is recommended you subscribe to the very low traffic Clojars Mirrors mailing list. This will be used to send updates when there are changes to the repo that may affect you.

Membership to this mailing list is hidden, so you can subscribe to it without revealing you or your company's use of Clojars.

Using an official mirror

If Clojars goes down, you can still read from the repo (but not deploy new artifacts) by using a mirror. See MIRRORS for a list of official public mirrors, then follow the directions below for your particular build tool.

Leiningen

{{TODO: add info about offline mode}}

There are two types of repositories read by Leiningen:

  • :repositories - used for project dependencies
  • :plugin-repositories - used for plugins and their dependencies

For lein to work properly when clojars is down, you may need to set them, possibly in different places.

You can replace the clojars repo system-wide by adding the following to your ~/.lein/profiles.clj:

:user {:repositories [["clojars" {:url "{{mirror-url}}"}]]
       ;; other :user profile settings...
       }

Lein will complain about :repositories being in the :user profile, but will still work.

If you need to use plugins outside of a project (this includes templates to the new task), you'll need to put the following in ~/.lein/profiles.clj:

:user {:plugin-repositories [["clojars" {:url "<mirror-url>"}]]
     ;; other :user profile settings...
     }

Due to an issue with Leiningen, you'll also need to set the :plugin-repositories in your project.clj if you have any project-level plugins.

If these steps don't work for you, Please file an issue with the contents of your ~/.lein/profile.clj and your project.clj, along with the output of lein version.

Boot

add the following to your ~/.boot/profile.boot:

(set-env!
  :repositories  
         [["central" {:url "http://repo1.maven.org/maven2" :snapshots false}]
          ["clojars" {:url "<mirror-url>"}]])

This will override the existing repo list, and since you are replacing the list, you have to include the other default repo as well. If you have projects that have custom repos added in build.boot, you will need to add them to the above list (or set the full list in in your build.boot).

Note: Boot does not currently support overriding repos for the initial downloading of its own dependencies (eg., the first time a new version of Boot is run).

If these steps don't work for you, Please file an issue.

Maven

Simply override the url for the clojars repository, either in your ~/.m2/settings.xml or the pom.xml of the project.