Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend via dependencies rather than custom configuration #576

Open
delanym opened this issue Apr 14, 2023 · 8 comments
Open

Extend via dependencies rather than custom configuration #576

delanym opened this issue Apr 14, 2023 · 8 comments
Assignees

Comments

@delanym
Copy link

delanym commented Apr 14, 2023

The usual way to extend plugin functionality is to add a dependency
https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_.3Cdependencies.3E_Tag

Is it too late for that?

@hazendaz
Copy link
Member

hazendaz commented Apr 14, 2023 via email

@delanym
Copy link
Author

delanym commented Apr 15, 2023

Well for one thing the plugin-plugins can't be declared under dependencyManagement and all the instrumentation that goes with that like updating via versions-maven-plugin or including in a bom. The dependency:resolve-plugins goal also comes up dry, and I imagine security checkers will not find these plugins.

Im also getting this annoying issue: #296

See also #23

@hazendaz
Copy link
Member

@delanym Thank you, no its not too late to figure out a better way to write this. The plugins are passed to spotbugs though which is probably why the original design was done. But I'd have to look at this more to understand the original reason and why it cannot use standard practice. If you have an idea already how to rewrite this to do just that, feel free to try doing the work and raising PR for same. We have extensive integration tests on this so in theory it should be possible. Not to mention, it should be rather trivial if spotbugs requires special pass to it to switch to doing just that in standard way. In fact, I'm pretty sure the current logic even from maven standpoint is deprecated here and needs work as it is for maven 3.9 and ultimately 4.0.

I don't personally have a lot of time to look at this right now but do understand what the need is. Security checkers do see this. For example, see hazendaz/base-parent#437 from Renovate, it knows of the plugins and will send updates when they are available to which it does.

@hazendaz hazendaz self-assigned this Apr 15, 2023
@delanym
Copy link
Author

delanym commented Apr 16, 2023

Looks complicated. Not sure I've got the chops for it.

@hazendaz
Copy link
Member

Thought more on this, here is part of the reason its done the way that it is. The plugins end up passed to spotbugs. But also there could be some unlimited # of plugins to add that we don't even know about. Anyone could write an extension. So that is likely why its this way. Yes having it known here in maven would allow it to work quite a bit differently but we would need to still know what to translate over to plugins in the end when calling spotbugs as its spotbugs that deals with the extensions themselves. Even if just on classpath, they would not really know its an extension to use as far as I know.

IMHO, the versions plugin is effectively redundant these days. It might also very well know about this as usage of spotbugs maven plugin is extremely high. Keeping this open though as interesting idea in general but would need to be balanced with keeping it working as-is as well.

@hazendaz
Copy link
Member

So one thing that potentially could be done is to add them as dependencies, then have a pluginList that would know which ones to pluck from the classpath to pass onto spotbugs. That way its in no way limited but in some regard that duplicates setup and not sure of the value other than maybe to versions plugin if it doesn't already understand spotbugs. I say that only because at one point in time this plugin was actually under codehaus with the other mojos at least in various forks. And if not mistaken some long timers on maven worked on this at points in time long back.

@delanym
Copy link
Author

delanym commented Apr 27, 2023

IMHO, the versions plugin is effectively redundant these days.

Ok, but whatever replaces it would follow the same approach?

@hazendaz
Copy link
Member

correct, it would have to. spotbugs requirements not ours in the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants