我使用以下方法创建了一个简单的示例:
%> lein new lein-check
我只修改了代码,使其现在有一个“主要”:
(defproject lein-check "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main "lein-check.core"
:dependencies [[org.clojure/clojure "1.4.0"]])
(ns lein-check.core
(:gen-class))
(defn -main
"I don't do a whole lot."
[& args]
(println "Hello, World!"))
lein uberjar
但是即使在clean
我得到这个之后,我第一次跑步也是如此:
Compiling lein-check.core
Exception in thread "main" java.lang.ClassCastException:
java.lang.String cannot be cast to clojure.lang.Symbol
at clojure.core$find_ns.invoke(core.clj:3659)
at clojure.core$load_one.invoke(core.clj:5228)
at clojure.core$compile$fn__4895.invoke(core.clj:5426)
at clojure.core$compile.invoke(core.clj:5425)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Compilation failed: Subprocess failed
uberjar
尽管成功创建了 jar ,但运行后续操作:
Created ....\lein-check-0.1.0-SNAPSHOT.jar
Including lein-check-0.1.0-SNAPSHOT.jar
Including clojure-1.4.0.jar
Created ....\lein-check-0.1.0-SNAPSHOT-standalone.jar
uberjar 有时会在完成后运行 main 吗?它应该这样做吗?我不太确定这是用户错误、lein
错误还是 clojure 错误。