Add pedantic setting for strict-on-deps but sloppy-on-plugins
If a plugin causes a version range etc then :pedantic? :abort will abort the build however plugins are optional and can be global in profiles.clj. I don't necessarily want my build to fail because a global lint plugin I use gives version problems as this is in no way involved in my actual build, I may not ever use this plugin for this project. I think it should only be an option such as :pedantic? :plugin-abort.
The problem with this is by the time dependency/plugin resolution happens, the profiles have already been merged, so there is no way to detect the provenance of plugins. Since having the wrong version of a project.clj plugin could result in changed behavior, we can't just ignore discrepancies here.
The biggest problem for me then is global plugins in my profiles.clj, is there a way to exclude these using profiles or something?
Wait, if that is the case, are my plugins dependencies in the uberjar I build for example? That would be crazy and I'm sure it's not the case so how does that happen? Am I misunderstanding something here? It's not only the global plugins I am bothered about so surely it doesn't matter that the profiles have been merged, I may also want to add a lint plugin to my project.clj but I don't care that there are some dependency conflicts, it doesn't affect the project at runtime. I don't want to pollute my project dependencies with loads of exclusions just because of this one plugin.
No, an uberjar will not contain plugins. AFAIK, it's just that the dependency fetching for plugins uses the same functions to resolve and fetch dependencies, which also checks pedantic options.
That's as I imagined. Given that I don't quite understand why it's not possible to have a separate pedantic check for plugins, therefore allowing the option of not aborting? Can someone point to where in the code this occurs? I don't want to keep asking questions when I should be looking at the code :-)
https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj – see the function get-dependencies and walk up from there.
It's true that an uberjar will typically not be affected by problems with plugins; however, there are many cases where it will be. If :prep-tasks includes an entry that uses a plugin, then it's crucial that the plugin versions are correct. In addition, if Leiningen is being used to build something that's not an uberjar (a war file or a tar file) then that's another case where getting the wrong version of the plugin can have adverse consequences, and it's important that the :pedantic? setting remain strict.
To clarify, we can add a setting that is only pedantic for dependencies and ignores discrepancies in plugins, but we cannot make the existing functionality suddenly start ignoring plugin discrepancies.
well for me personally that would be perfect, I do understand that the default should be as strict as possible but I would have thought that my use case would be quite common so it would be great to have an option. Can this be left as an open issue then, that can be fixed?
Yeah, happy to leave this to track developing a less-strict pedantic mode.
I've just bumped into this myself (profile plugins colliding with pedantic mode)