I want to be able to query or embed the version string set by the leiningen project and display that value to user. Uses include displaying the version string from the CLI,
I like technomancy's answer, but I had to go look up how to "read pom.properties". It turns out that for the maven artifact com.example/my-project, there is a file on the classpath under
META-INF/maven/com.example/my-project/pom.properties
which you can read into a java.util.Properties and get out a "version" key.
(ns com.example.version
(:require [clojure.java.io :as io])
(:import (java.util Properties)))
(defn read-project-version [groupid artifact]
(-> (doto (Properties.)
(.load (-> "META-INF/maven/%s/%s/pom.properties"
(format groupid artifact)
(io/resource)
(io/reader))))
(.get "version")))