Getting the version of the current clojure project in the repl

zcaudate picture zcaudate · Apr 29, 2013 · Viewed 8.2k times · Source

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" ....)

When running a repl in the project directory, is there a function like this?

> (project-version) 
;=> 0.1.2 

Answer

Paul Legato picture Paul Legato · Oct 8, 2014

While you can parse project.clj yourself, this may be annoying. It's also a lot of work. Instead, you can just do:

(System/getProperty "projectname.version")