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

Allow to load plugin with same artifactIds/PluginIds #290

Open
dmitry-timofeev opened this issue Mar 1, 2019 · 4 comments
Open

Allow to load plugin with same artifactIds/PluginIds #290

dmitry-timofeev opened this issue Mar 1, 2019 · 4 comments

Comments

@dmitry-timofeev
Copy link
Contributor

Overview

It would be wonderful if PluginManager operations identified the plugins by (PluginId, PluginProvider, Version) so that applications can simultaneously work with plugins:

  • From different providers (that might pick the same pluginId).
  • Of several versions ("foo-plugin" of 1.5.1 and 2.0.1).

The present recommended values for plugin metadata are:

  • artifactId for PluginId
  • groupId for PluginProvider
  • version for PluginVersion

Such values make perfect sense and are easy to understand, however, with pluginId=artifactId the scenarious above do not work.


Alternatively, the default recommended value for PluginId might be changed in all examples in documentation to "groupId:artifactId:version" so that it is used by default by the users.

Workaround

Set pluginId to "groupId:artifactId:version" so that it is unique for any plugin.

See also:

@dmitry-timofeev dmitry-timofeev mentioned this issue Mar 1, 2019
3 tasks
@wolframhaussig
Copy link
Contributor

I think that the parallel loading of plugins with the same pluginId but different providers is a real usecase(e.g. having a db-support-plugin from both com.oracle and com.microsoft) but I do not see the real benefit of loading different versions here.

Also, I see a problem of backwards-compatibility here - if we have a Map<PluginId, PluginWrapper> in AbstractPluginManager which allows having the same pluginName what would public PluginWrapper getPlugin(String pluginId) return when a duplicate pluginName is given? I think this would be best handled in #372 so we can switch from public PluginWrapper getPlugin(String pluginId) to public PluginWrapper getPlugin(PluginId pluginId).

@decebals
Copy link
Member

decebals commented Jun 13, 2021

Maybe the simple solution in this case is to use a more complicated pattern for pluginId (a package name or groupId + artifactId). In the end is a matter of convention and application organization. Using Maven or Gradle I think that the pluginId = groupId + artifactId can be done automatically.

@wolframhaussig
Copy link
Contributor

You are right, there is just the benefit of having a few quality of life features, e.g.:

  • start/stop all plugins from a provider
  • whitelist/blacklist providers in enabled.txt / disabled.txt
  • ...

Of course, one could always implement something like this yourself but it would be harder because the pluginId string would have to be parsed and checked(e.g. some plugin providers only use the pluginId itself, some use provider-pluginId while others use provider:pluginId, ...)

@decebals
Copy link
Member

because the pluginId string would have to be parsed and checked

Why the pluginId string should be parsed? In the end it's about convention/rule. For example in Java Module for module name we have java.xml, jdk.charsets. It's more or less mandatory to include a namespace as prefix (root package name, organization id, ...). We will see in the future if we should do something related this topic (some constrain or similar), when we will have a concrete situation.

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

3 participants