简体   繁体   中英

Why does my Clojure import fail?

I'm running Clojure 1.3 with contrib 1.1 in IntelliJ. My program consists of a single line

(use 'clojure.contrib.prxml)

I get the following error upon running

Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

I'm running Clojure 1.3 with contrib 1.1

There's your problem. Clojure and contrib versions are linked against each other, and are not compatible across versions.

Even more, contrib has been split up into lots of smaller libraries as of 1.3, so there is really no version of "monolithic contrib" that you can use with 1.3.

In addition to the answers saying that contrib 1.1 is incompatible with clojure 1.3

Taken from here :

Versions of clojure-contrib are matched to versions of Clojure.

If you are using Clojure 1.0, use clojure-contrib 1.0.

If you are using Clojure 1.1, use clojure-contrib 1.1.

If you are using Clojure 1.2, use clojure-contrib 1.2, or the new modular Contrib libraries.

If you are using Clojure 1.3, use the new modular Contrib libraries.

As of the date of this reply I'm not sure if there is a version of clojure.contrib.prxml that is compatible with clojure-1.3 (Someone please correct me if I'm wrong).

So I would suggest using clojure-1.2.1 and clojure-contrib 1.2.0 .

Nothing is wrong with the call works with clojure 1.2 and contrib 1.2

If you don't need anything 1.3 specific I would suggest sticking to 1.2 for the time being, use clojure 1.2 and contrib 1.2 until contrib authors properly make the transition to 1.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM