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

Add packagingTypes extension point #538

Closed
wants to merge 2 commits into from
Closed

Add packagingTypes extension point #538

wants to merge 2 commits into from

Conversation

kjsmita6
Copy link

Our application has a few custom Maven packaging types that do not show up in the drop-down and must be typed in manually in the pom.xml. This small change adds an extension point that allows the developers of the product/plugins to define packaging types that will be added to the pom editor.

The extension point is defined by the following:
extensionpoint
which will add a packaging type test-packaging-type. This type does not actually exist and is only here for testing, which is why the next screenshot shows an error. The plugin developers should make sure that the packaging type actually will exist in the launched product.

Then, in the launched product, see the type in the pom editor drop-down.
ccombo

This is my first contribution to any Eclipse project, so please let me know if I did something incorrectly.

@mickaelistria
Copy link
Contributor

Thanks, we'll try to look at it shortly. We first need a positive review from CI to validate this change doesn't introduce regressions.

@laeubi
Copy link
Member

laeubi commented Feb 1, 2022

I think this is another reincarnation of missing extension support in m2e as packaging types are normally declared via a plugin in the pom already.

@mickaelistria
Copy link
Contributor

I think this is another reincarnation of missing extension support in m2e as packaging types are normally declared via a plugin in the pom already.

That's right!
So I don't think we want a new extension point for that, if this information is supposed to be accessible dynamically from the Maven project.

@mickaelistria
Copy link
Contributor

Sorry @kjsmita6 but as @laeubi identified, this proposal is not really correct nor sufficient for m2e. We can achieve much better results by looking up build extensions (that's not trivial though, as #118 tracks). So I think we're going to close this PR.
However you may want to create a new PR adding a comment in the Overview page to remind that with extension support, it would be possible to dynamically list all packaging types that make sense for the current project.

@laeubi
Copy link
Member

laeubi commented Feb 1, 2022

(that's not trivial though, as #118 tracks

That said, we already have some workarounds for packaging types in place in m2e, maybe this could simply be reused her, take a look at:

// extension plugins (affect packaging type calculation)
for(Plugin plugin : mavenProject.getBuildPlugins()) {
if(plugin.isExtensions()) {
ArtifactKey artifactKey = new ArtifactKey(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
null);
requirements.add(MavenRequiredCapability.createMavenArtifact(artifactKey, "plugin", false)); //$NON-NLS-1$
}
}

one could the parse these plugins for components.xml descriptors declaring new packaging types (thats how maven seems to handle them).

@mickaelistria
Copy link
Contributor

That would be very good and it may open some first breaches towards tackling #118.
@kjsmita6 are you interested in implementing the approach suggest by @laeubi , introspecting the project plugins for declared packaging types?

@kjsmita6
Copy link
Author

kjsmita6 commented Feb 1, 2022

@mickaelistria I could be interested in working on this, as it's something we need in our product. I will investigate some things, try and implement them, and create another PR when necessary.

@mickaelistria
Copy link
Contributor

@kjsmita6 Thanks! And feel free to ping on issues or on the m2e-dev mailing-list if you need any assistance.

@laeubi
Copy link
Member

laeubi commented Feb 1, 2022

And feel free to ping on issues or on -the m2e-dev mailing-list- if you need any assistance.

Better use the https://github.com/eclipse-m2e/m2e-core/discussions

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

Successfully merging this pull request may close these issues.

4 participants