Search code examples
clojureleiningenclojure-contrib

Where to find valid version numbers for dependencies in Leiningen


I'm new to Clojure and Leiningen, and I've determined that some of what I'll want to use is located in clojure.contrib.generic.math-functions. I found API information for that at http://richhickey.github.com/clojure-contrib/branch-1.1.x/math-api.html, but I can't find anything that helps me figure out what I should put into my project.clj file for that dependency.

I have tried [clojure.contrib.generic.math-functions "1.1"], [clojure.contrib.generic.math-functions "1.1.x"], and [clojure.contrib.generic.math-functions "1.1.0"]. For each of those, I get something like...

...
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
----------
1) clojure.contrib.generic.math-functions:clojure.contrib.generic.math-functions:jar:1.1

Solution

  • All clojure-contrib namespaces are shipped within a single jar file, for which the dependency has to be listed like:

    [org.clojure/clojure-contrib "1.2.0"]
    

    Please note that there are different versions available of that artifact. The 1.2.0 is the current stable release.

    In order to use functions coming from the math-functions namespace in your clojure code, you need to either require or use such namespace, usually done within the ns form at the beginning of your source file:

    (ns my.namespace
        (:use [clojure.contrib.generic.math-functions]))
    

    Have a look here to see the differences between use and require.