technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

[Tutorial] how to access "project map" from clojure code? #2782

Closed y2kenny closed 2 years ago

y2kenny commented 2 years ago

In the "Profiles" section of the tutorial, there are several mentions of "project map". Is project map simply the "defproject" in project.clj? Is there a way to access the value of the merged version of the project map?

technomancy commented 2 years ago

The project map is visible from plugins; it is the first argument passed to any plugin task function.

It is not meant to be visible from inside the project, but there is a pom.properties file on the classpath that has a limited amount of information about the project.

technomancy commented 2 years ago

Oh, you can also use the lein-pprint plugin if you just want to see the project map rather than using it from code: https://clojars.org/lein-pprint

y2kenny commented 2 years ago

ah ok. Thanks for the tips. After a bit of searching I saw suggestion of using environ and setting :env for different Profiles as well.