Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Many different build tools and Java IDEs use public Maven repositories to download dependencies. This page lists the Maven repositories where Clojure and contributed libraries may be found, and how to configure them in different build tools.

Leiningen Quick Start

To use Clojure and contrib library releases in your Leiningen project, there's nothing special to do. Just add dependencies in project.clj

To use Clojure and contrib library SNAPSHOTS in your Leiningen project, add the following to your project.clj:

Code Block
:repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}

 

A note about releases versus snapshots

Maven repositories distinguish between releases and snapshots.

...

If you use a -SNAPSHOT version in your project dependencies, most Maven-based tools will automatically check for updated versions of that snapshot. (Maven itself allows you to disable this behavior with the -o option.) To pin your dependency at a specific snapshot version, use the full version string with the timestamp.

Clojure

...

& Contrib library releases

New snapshots and releases are uploaded to the public Sonatype open-source repository at https://oss.sonatype.org/content/groups/public/

...

Nothing to do here. Maven-based tools, including Leiningen, always check the Maven Central Repository for releases.

It takes up to 24 hours for a new release to be sync'd from the Sonatype repository to Maven Central. If you want to get a new release sooner, use the same instructions as for snapshot repositories, below.

How to configure snapshot repositories in Leiningen

In a

...

Leiningen/Cake project.clj file:

Code Block
langxmlnone
    :repositories {"sonatype-oss-public"  <repositories>
"https://oss.sonatype.org/content/groups/public/"}

How to configure snapshot repositories in Gradle

In a Gradle build.gradle file:

Code Block
langnone
repositories {
  mavenRepo urls: "https://oss.sonatype.org/content/groups/public/"
}
 <repository>
 

How to configure snapshot repositories in Maven

In a Maven project's pom.xml file:

Code Block
<repositories>
  <repository>
        <id>sonatype-oss-public</id>
          <url>https://oss.sonatype.org/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>

In a Leiningen/Cake project.clj file:

Code Block
langnone

    :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}

In a Gradle build.gradle file:

Code Block
langnone

repositories {
  mavenRepo urls: "https://oss.sonatype.org/content/groups/public/"
}

How to configure snapshot repositories globally in Maven

This only works if you are building your projects with Maven itself, not with Maven-based tools such as Leiningen.

In your ~/.m2/settings.xml file:

Code Block
langlanguagehtml/xml

<settings>
  <profiles>
    <profile>
      <id>sonatype</id>
      <repositories>
        <repository>
          <id>sonatype-oss-public</id>
          <url>https://oss.sonatype.org/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>sonatype</activeProfile>
  </activeProfiles>
</settings>

Historical Notes

Monolithic "clojure-contrib" after 1.2.0

After the 1.2.0 release, clojure-contrib was split into multiple sub-modules. This proved even more cumbersome than the monolithic clojure-contrib, and is being phased out. There is no plan to release clojure-contrib post-1.2.0 in either monolithic or modularized forms.

Instead, new development of "contrib" libraries is occurring in independent Git repositories. Each library can have its own version and release cycle, independent of Clojure. Snapshots and releases of these "new contribs" are uploaded to the public repository at oss.sonatype.org and sync'd to Maven central just like Clojure itself.

How to configure repositories

...

Clojure

...

and

...

clojure-contrib releases 1.2.0 and earlier

For Clojure the language and clojure-contrib versions 1.0.0, 1.1.0, and 1.2.0, releases and snapshots were uploaded to a public repository at http://build.clojure.org/releases and http://build.clojure.org/snapshots respectively.

...