What do :project/dev and :profiles/dev mean in a Leiningen project?
A few years ago I came across a Leiningen project that defined profiles for :project/dev
, :profiles/dev
, :project/test
, and :profiles/test
. It took me a little bit of digging, but eventually I discovered what was happening. This is a convention that I think originated with James Reeves. I’m reposting my issue comment here, so it can be more accessible for searchers.
If you see profiles like this in a project.clj
, here is what is happening:
:dev [:project/dev :profiles/dev]
:test [:project/test :profiles/test]
:profiles/dev {}
:profiles/test {}
:project/dev { ... }
:project/test { ... }
Leiningen has a feature called Composite Profiles. On startup, if Leiningen sees a vector of keywords for a profile, it will lookup each keyword as a profile, and merge them together. For the :dev
profile, Leiningen will merge the values of :project/dev
and :profiles/dev
.
If you want to add any custom settings or dependencies for your own use, you can place them into the :profiles/dev
or :profiles/test
in your ~/.lein/profiles.clj
. If either of these are set in the user’s profiles.clj
, they will override the empty :profiles/dev
map specified in the project.clj
. You need an empty map for :profiles/dev {}
in the project.clj
, because otherwise Leiningen will complain about a missing profile.