如何让 `lein-repl` 使用 `user` 而不是 `main` 用于开发目的
How to get `lein-repl` to use `user` instead of `main` for development purposes
我正在尝试通过 project.clj
.
使用 leiningen
设置我的应用程序的开发版本和生产版本
我怎样才能两者兼得?因为我必须注释掉 project.clj
的 :main
部分,以便在我使用 lein repl
.
时访问开发版本
所以我正在使用 stuartsierra/reloaded leiningen template,它有一个很好的开发环境。
它没有 :main
密钥,当我添加一个时,我就停止获取项目的开发版本了。
而不是看到
user=>
当我键入 lein repl
时,我最终看到了我的主程序,它位于 jaribu
命名空间
io.wakamau.jaribu=> ;; my main
似乎可行的解决方案是注释掉 project.clj
.
的 :main
部分
(defproject io.wakamau/jaribu "0.1.0-SNAPSHOT"
:description "trying out pedestal and component"
:url "https://github.com/kevinmungai/jaribu"
:license {:name "TODO: Choose a license"
:url "http://choosealicense.com/"}
:dependencies [[org.clojure/clojure "1.10.0"]
[com.stuartsierra/component "0.3.2"]]
:profiles {:dev
{:dependencies [[org.clojure/tools.namespace 0.2.11"]
[com.stuartsierra/component.repl "0.2.0"]]
:source-paths ["dev"]}
:uberjar {:aot [io.wakamau.jaribu]}}
:main ^{:skip-aot true} io.wakamau.jaribu
:min-lein-version "2.0.0")
尝试
lein repl
结果:
io.wakamau.jaribu=>
当:main
被注释掉时:
(defproject io.wakamau/jaribu "0.1.0-SNAPSHOT"
...
;; :main ^{:skip-aot true} io.wakamau.jaribu
:min-lein-version "2.0.0")
结果是:
user=>
不得不承认,我对leiningen
的使用了解不多。
您可以指定:repl-options {:init-ns io.wakamau.jaribu=>}
in project.clj
. You can also specify constants for different environments in profiles.clj
, e.g., :dev {:main io.wakamau.jaribu}
. Also see How do I start the REPL in a user defined namespace?。
我正在尝试通过 project.clj
.
leiningen
设置我的应用程序的开发版本和生产版本
我怎样才能两者兼得?因为我必须注释掉 project.clj
的 :main
部分,以便在我使用 lein repl
.
所以我正在使用 stuartsierra/reloaded leiningen template,它有一个很好的开发环境。
它没有 :main
密钥,当我添加一个时,我就停止获取项目的开发版本了。
而不是看到
user=>
当我键入 lein repl
时,我最终看到了我的主程序,它位于 jaribu
命名空间
io.wakamau.jaribu=> ;; my main
似乎可行的解决方案是注释掉 project.clj
.
:main
部分
(defproject io.wakamau/jaribu "0.1.0-SNAPSHOT"
:description "trying out pedestal and component"
:url "https://github.com/kevinmungai/jaribu"
:license {:name "TODO: Choose a license"
:url "http://choosealicense.com/"}
:dependencies [[org.clojure/clojure "1.10.0"]
[com.stuartsierra/component "0.3.2"]]
:profiles {:dev
{:dependencies [[org.clojure/tools.namespace 0.2.11"]
[com.stuartsierra/component.repl "0.2.0"]]
:source-paths ["dev"]}
:uberjar {:aot [io.wakamau.jaribu]}}
:main ^{:skip-aot true} io.wakamau.jaribu
:min-lein-version "2.0.0")
尝试
lein repl
结果:
io.wakamau.jaribu=>
当:main
被注释掉时:
(defproject io.wakamau/jaribu "0.1.0-SNAPSHOT"
...
;; :main ^{:skip-aot true} io.wakamau.jaribu
:min-lein-version "2.0.0")
结果是:
user=>
不得不承认,我对leiningen
的使用了解不多。
您可以指定:repl-options {:init-ns io.wakamau.jaribu=>}
in project.clj
. You can also specify constants for different environments in profiles.clj
, e.g., :dev {:main io.wakamau.jaribu}
. Also see How do I start the REPL in a user defined namespace?。