leiningen 2022-07-08

Hi folks. When lein calculates the classpath, is there anything special about dev dependencies? To be more precise: I’d like to add a dev dependency to my project, but I don’t want its transitive dependencies to override the ones calculated by the main dependencies. That is, I’d like to transitive dependencies from dev to always have a slower priority, so the classpath used using dev time is as close as possible to the one used in prod.

There's nothing special about dev (other than that it's being activated by default). However any given profile is more specific that the 'base' dependencies of a project map, which is why they're taking priority. I think the standard approach is to use :pedantic? so that conflicting transitive deps are reported as such. Sometimes :pedantic? in dev is very annoying, but it might be sound to run it in CI as a 'linter' of sorts.

Got it. For now, I’m just reasoning about the consequences of adding a dev dependency.

Actually, it would be added to a lein profile. I suppose the logic is the same, still.

👍 1

You can also directly declare a transitive dependency if you want to be sure a certain version is used in resolution

👍 1

After reading [1], I suppose there’s no special logic related to dev deps. They are concatenated to dependencies.