开发者

Wrong number of args passed to: repl$repl

I have a trouble with a compojure "Getting started" example that I do notunderstand. When I run the example from http://weavejester.github.com/compojure/docs/getting-started.html

...I get the following error at the lein repl step:

~/hello-www> lein repl src/hello_www/core.clj
Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: repl$repl (NO_SOURCE_FILE:0)
    at clojure.lang.Compiler.eval(Compiler.java:5359)
    at clojure.lang.Compiler.eval(Compiler.java:5311)
    at clojure.core$eval__4350.invoke(core.clj:2364)
    at clojure.main$eval_opt__6502.invoke(main.clj:228)
    at clojure.main$initialize__6506.invoke(main.clj:247)
    at clojure.main$script_opt__6526.invoke(main.clj:263)
    at clojure.main$main__6544.doInvoke(main.clj:347)
    at clojure.lang.RestFn.invoke(RestFn.java:483)
    at clojure.lang.Var.invoke(Var.java:381)
    at clojure.lang.AFn.applyToHelper(AFn.java:180)
    at clojure.lang.Var.applyTo(Var.java:482)
    at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: Wrong number of args passed to: repl$repl
    at clojure.lang.AFn.throwArity(AFn.java:439)
    at clojure.lang.AFn.invoke(AFn.java:43)
    at clojure.lang.Var.invoke(Var.java:369)
    at clojure.lang.AFn.applyToHelper(AFn.java:165)
    at clojure.lang.Var.applyTo(Var.java:482)
    at clojure.core$apply__3776.i开发者_Python百科nvoke(core.clj:535)
    at leiningen.core$_main__59$fn__61.invoke(core.clj:94)
    at leiningen.core$_main__59.doInvoke(core.clj:91)
    at clojure.lang.RestFn.applyTo(RestFn.java:138)
    at clojure.core$apply__3776.invoke(core.clj:535)
    at leiningen.core$_main__59.invoke(core.clj:97)
    at user$eval__67.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:5343)
    ... 11 more

I have tried both the stable and the developer version of lein without any success. Any ideas on what I could look for next? I get the same result both on linux and cygwin.

When I run it manually, it seems to work fine on linux:

java -cp "lib/*" clojure.main  src/hello_www/core.clj
2010-05-17 19:34:17.280::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2010-05-17 19:34:17.281::INFO:  jetty-6.1.14
2010-05-17 19:34:17.382::INFO:  Started SocketConnector@0.0.0.0:8080


Taking into account your comment on the question -- the relevant part is "With lein-stable it works, but not with master from git." -- I'd say that you're being hit by Leiningen's new handling of the repl task introduced in commit 44b6369aec1e23bcda1db1b6570a03ca524464e5 from 16th April 2010.

Leiningen 1.1 was released on 16th February and does things the old way, which means the repl task is handled specially by the lein script; post-44b6369aec Leiningen handles the repl task the same way as all the others, i.e. through the leiningen.repl/repl function. The latter simply doesn't accept additional arguments, hence the arity-related IllegalArgumentException that you're seeing. Before you ask, I'm not sure if that is likely to change in the future.

What should work is lein repl followed by (require 'hello-www.core); regrettably, however, there seems to be an issue with Leiningen's HEAD which prevents that from working (at least on my box). It's a safe bet to expect that it's going to get fixed eventually, but for the time being, just use lein-stable. That Compojure tutorial uses Clojure 1.1 and not the bleeding edge... It might save you some time to treat Leiningen the same way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜