12
有沒有一種方法可以在leiningen的項目中定義類似rake的任務。在leiningen中定義項目特定的任務
我要定義leiningen project.clj一個自定義的任務,它在我的項目命名空間中調用一個函數
有沒有一種方法可以在leiningen的項目中定義類似rake的任務。在leiningen中定義項目特定的任務
我要定義leiningen project.clj一個自定義的任務,它在我的項目命名空間中調用一個函數
您可以define project-specific aliases,如:
:aliases {"launch" ["run" "-m" "myproject.main"]
;; Values from the project map can be spliced into the arguments
;; using :project/key keywords.
"launch-version" ["run" "-m" "myproject.main" :project/version]
"dumbrepl" ["trampoline" "run" "-m" "clojure.main/main"]
;; :pass-through-help ensures `lein my-alias help` is not converted
;; into `lein help my-alias`.
"go" ^:pass-through-help ["run" "-m"]
;; For complex aliases, a docstring may be attached. The docstring
;; will be printed instead of the expansion when running `lein help`.
"deploy!" ^{:doc "Recompile sources, then deploy if tests succeed."}
;; Nested vectors are supported for the "do" task
["do" "clean" ["test" ":integration"] ["deploy" "clojars"]]}
您應該能此功能結合與lein-exec
plugin定義別名到您的項目中運行任意代碼的Clojure:
:aliases {"dosmth" ["exec" "-ep" "(use 'myproject.main) (foo 42)"]}
現在你可以使用dosmth
任務與lein
:
lein dosmth
這只是一個別名
lein exec -ep "(use 'myproject.main) (foo 42)"
你的問題的人誰不知道耙(像我)還不是很清楚。你能詳細說明嗎?大致猜測你需要什麼(考慮make-style目標),我想你可能會發現[boot](https://github.com/boot-clj/boot)更適合你的需求。 – schaueho