3

The old monolithic clojure.contrib was available as a .jar from the same place you got the clojure .jar, and you used it by pointing your classpath at it. As far as I can tell, the new modular contribs aren't available in the clojure .jar -- instead, they exist as source files on github. What's the expected way for you to use them? Say, e.g., I wanted to use something in clojure.math.numeric-tower. What would I do?

I've found How do I install Clojure 1.3 with contribs on RHEL 6.1 / JDK7?, but the only answer ("use leiningen") isn't detailed enough for me to figure out. (Searching clojars for numeric-tower yields... nothing.)

Community
  • 1
  • 1
collapsinghrung
  • 855
  • 1
  • 6
  • 7

4 Answers4

3

As stated in Maven Settings and Repositories the repository where all clojure artifacts are deployed is Sonatype OSS Nexus. If you don't want to go the leiningen or maven way, which I would still advise you to consider also for one-off experiments, you can still download manually all the artifacts from that repository. Specifically, here's all the uploaded versions of clojure.math.numeric-tower.

skuro
  • 13,414
  • 1
  • 48
  • 67
3

I can understand the reluctance to using leiningen though it took me longer to write this sentence than to create a new project.

my usual first stop for this sort of question is http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go then clicking latest release and get the artifact I'd and version, then add a line to the project.clj's dependencies section like so

[math.numeric-tower "0.0.1"]
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • This isn't a reluctance to use leiningen. It's an observation that the bare instruction "use leiningen" doesn't tell you how to accomplish the goal. Right here you've used two pieces of information I didn't know how to get -- the artifact id, and a version number. – collapsinghrung Jun 10 '12 at 20:19
  • click on the latest release link under the name on this page, both are listed there. – Arthur Ulfeldt Jun 11 '12 at 18:06
3

You install a contrib module by adding its info to :dependencies in your project.clj file. The next time you run lein for something, it notices your change and automatically grabs the library for you.

I have some more detailed instructions written up here.

uvtc
  • 710
  • 3
  • 8
0

If you use Clojure, you should really also be using either Leiningen or Maven to manage your dependencies. I believe these are the only sane ways to stay on yop of a complex dependency graph as your project gets larger and has more complex build requirements.

For example, I use Maven and have the following in my project's pom.xml to include the numeric dependencies:

    <dependency>
        <groupId>org.clojure</groupId>
        <artifactId>math.numeric-tower</artifactId>
        <version>0.0.1</version>
    </dependency>

All the modular Clojure contrib libraries can be included in the same way.

mikera
  • 105,238
  • 25
  • 256
  • 415