https://github.com/technomancy/leiningen/blob/master/sample.project.cljによると 、:repl-options 内に :init をアタッチできます。
ただし、試してみると:
lein version; echo "====="; cat project.clj; echo "====="; lein repl
出力が得られます:
Leiningen 1.7.1 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM
=====
(defproject
test "0.0.1"
:dependencies [[org.clojure/clojure "1.3.0"]]
:source-paths ["src"]
:jvm-opts ["-Xms4g" "-Xmx4g"]
:repl-options {
:init (println "Init")
}
)
=====
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jline.ConsoleRunner.main(ConsoleRunner.java:69)
Caused by: java.lang.IllegalArgumentException: No value supplied for key: [:init (println "Init")] (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
... 5 more
Caused by: java.lang.IllegalArgumentException: No value supplied for key: [:init (println "Init")]
at clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:89)
at clojure.core$hash_map.doInvoke(core.clj:327)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:540)
at leiningen.repl$repl_options.invoke(repl.clj:16)
at leiningen.repl$repl_server.doInvoke(repl.clj:69)
at clojure.lang.RestFn.applyTo(RestFn.java:146)
at clojure.core$apply.invoke(core.clj:546)
at leiningen.repl$repl.invoke(repl.clj:145)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:262)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval47.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 16 more
私は何を間違っていますか?
特に、なぜ :init がキーとして扱われるのではなく、 [:init +func+] がキーとして扱われるのかがわかりません。
ありがとう!