如果我理解您的问题,您仍然可以为此使用 :repl-init ,方法是调用要在 repl 加载的命名空间中预加载的类。在此示例中,我使用println
语句作为您要完成的设置的替代 :-)
项目.clj:
(defproject foooo "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:aot [foooo.core]
:main foooo.core
:repl-init foooo.core)
核心.clj
(ns foooo.core
(:gen-class))
(println "setting up for fun")
(defn -main [])
compile: arthur@a:~/foooo$ lein compile Compiling foooo.core 编译成功。
跑步:
arthur@a:~/foooo$ CLASSPATH=./lib/clojure-1.3.0.jar:./classes/ java foooo.core 1
setting up for fun
或者:
arthur@a:~/foooo$ lein run
setting up for fun
回复:
arthur@a:~/foooo$ lein repl
REPL started; server listening on localhost port 63392
setting up for fun
foooo.core=>