Runtime helper: read META-INF/<group>/<artifact>/build-provenance.edn from the running classpath. Returns nil if no such resource exists (e.g. loaded from a non-instrumented JAR or running from source).
Usage:
(require '[build-provenance.read :as bp])
;; Read a single artifact's provenance:
(bp/read 'com.example/my-library)
;; => {:artifact "com.example/my-library"
;; :version "1.2.3"
;; :commit "..."
;; :commit-abbreviated "..."
;; :branch "main"
;; :describe "v1.2.3"
;; :dirty false}
;; or nil if no build-provenance.edn is present for that artifact.
;; Enumerate every instrumented artifact on the classpath:
(bp/discover)
;; => [{:artifact "com.example/my-library" ...}
;; {:artifact "other.group/some-lib" ...}]
Runtime helper: read META-INF/<group>/<artifact>/build-provenance.edn
from the running classpath. Returns nil if no such resource exists
(e.g. loaded from a non-instrumented JAR or running from source).
Usage:
(require '[build-provenance.read :as bp])
;; Read a single artifact's provenance:
(bp/read 'com.example/my-library)
;; => {:artifact "com.example/my-library"
;; :version "1.2.3"
;; :commit "..."
;; :commit-abbreviated "..."
;; :branch "main"
;; :describe "v1.2.3"
;; :dirty false}
;; or nil if no build-provenance.edn is present for that artifact.
;; Enumerate every instrumented artifact on the classpath:
(bp/discover)
;; => [{:artifact "com.example/my-library" ...}
;; {:artifact "other.group/some-lib" ...}](discover)Scan the classpath for every embedded build-provenance.edn resource and return a vector of provenance maps, sorted by :artifact. Empty vector if no instrumented JARs/dirs are present.
Use this for health/status endpoints, diagnostics, and SBOM-adjacent reports where you want to enumerate every build identity in the running JVM without naming each lib coord up front.
Scan the classpath for every embedded build-provenance.edn resource and return a vector of provenance maps, sorted by :artifact. Empty vector if no instrumented JARs/dirs are present. Use this for health/status endpoints, diagnostics, and SBOM-adjacent reports where you want to enumerate every build identity in the running JVM without naming each lib coord up front.
(read lib)Return the build-provenance map for the given qualified-symbol lib, or nil if no build-provenance.edn is present on the classpath for that artifact.
Return the build-provenance map for the given qualified-symbol lib, or nil if no build-provenance.edn is present on the classpath for that artifact.
(read-from-path path)Return a vector of every embedded build-provenance map under path. path may be a path-String or java.io.File pointing to either a .jar file or a directory containing a META-INF/<group>/<artifact>/build-provenance.edn resource (e.g. an exploded class-dir). Returns an empty vector if path is not a JAR/dir, is unreadable, or contains no embedded provenance.
Unlike read (which goes through the running classloader), this reads
directly from the filesystem — useful for shell-side tools that want to
inspect arbitrary JARs without putting them on the JVM classpath.
Return a vector of every embedded build-provenance map under path. path may be a path-String or java.io.File pointing to either a .jar file or a directory containing a META-INF/<group>/<artifact>/build-provenance.edn resource (e.g. an exploded class-dir). Returns an empty vector if path is not a JAR/dir, is unreadable, or contains no embedded provenance. Unlike `read` (which goes through the running classloader), this reads directly from the filesystem — useful for shell-side tools that want to inspect arbitrary JARs without putting them on the JVM classpath.
(read-json-from-path path)Return a vector of raw JSON strings — one per embedded build-provenance.json resource under path. The lib's writer emits both .edn and .json variants from a single source map, so the JSON returned here is the canonical, non-Clojure-consumer-facing shape (camelCase keys). Useful for shell-side tools that want to surface JSON without round-tripping through a Clojure parser.
Return a vector of raw JSON strings — one per embedded build-provenance.json resource under path. The lib's writer emits both .edn and .json variants from a single source map, so the JSON returned here is the canonical, non-Clojure-consumer-facing shape (camelCase keys). Useful for shell-side tools that want to surface JSON without round-tripping through a Clojure parser.
(resource-path lib)(resource-path lib fmt)Return the per-artifact resource path for build provenance. fmt is :edn (default) or :json. The reader only consumes :edn — the JSON variant exists for non-Clojure consumers.
Return the per-artifact resource path for build provenance. fmt is :edn (default) or :json. The reader only consumes :edn — the JSON variant exists for non-Clojure consumers.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |