Getting the version of the current clojure project in the repl

后端 未结 8 1579
太阳男子
太阳男子 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:24

    I use environ (https://github.com/weavejester/environ) which sucks in settings from a number of sources, including system properties. The project version appears as :<project-name>-version:

    foobar.repl=> (require '[environ.core :refer [env]])
    nil
    foobar.repl=> (:foobar-version env)
    "0.1.0-SNAPSHOT"
    
    0 讨论(0)
  • 2020-12-08 21:25

    For a more fully-featured approach, you might want to take a look at the configleaf plugin for Leiningen (https://github.com/davidsantiago/configleaf). It will make the project map, with active profiles merged in, available to project code in a namespace of your choosing.

    0 讨论(0)
提交回复
热议问题