Getting the version of the current clojure project in the repl

后端 未结 8 1580
太阳男子
太阳男子 2020-12-08 20:27

Is it possible to grab the project information within the clojure repl?

For example, if there was a project defined:

(defproject blahproject \"0.1.2\         


        
8条回答
  •  無奈伤痛
    2020-12-08 21:14

    Add the below code to the end of project.clj:

    (def project (assoc-in project [:repl-options :init]
                           `(~'def ~'project-version ~(project :version))))
    

    Now you will have a var called project-version in the initial namespace for the repl.

提交回复
热议问题