leiningen icon indicating copy to clipboard operation
leiningen copied to clipboard

Add pedantic setting for strict-on-deps but sloppy-on-plugins

Open shmish111 opened this issue 10 years ago • 11 comments

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.

shmish111 avatar Aug 27 '15 10:08 shmish111

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.

technomancy avatar Aug 28 '15 03:08 technomancy

The biggest problem for me then is global plugins in my profiles.clj, is there a way to exclude these using profiles or something?

shmish111 avatar Aug 28 '15 09:08 shmish111

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.

shmish111 avatar Aug 28 '15 09:08 shmish111

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.

hypirion avatar Aug 28 '15 11:08 hypirion

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 :-)

shmish111 avatar Aug 28 '15 11:08 shmish111

https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj – see the function get-dependencies and walk up from there.

hypirion avatar Aug 28 '15 11:08 hypirion

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.

technomancy avatar Aug 28 '15 12:08 technomancy

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.

technomancy avatar Aug 28 '15 12:08 technomancy

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?

shmish111 avatar Aug 28 '15 12:08 shmish111

Yeah, happy to leave this to track developing a less-strict pedantic mode.

technomancy avatar Aug 28 '15 13:08 technomancy

I've just bumped into this myself (profile plugins colliding with pedantic mode)

SevereOverfl0w avatar Dec 21 '15 11:12 SevereOverfl0w