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

org.eclipse.m2e.archetype.common listed as fragment in m2e.feature #1537

Open
kysmith-csg opened this issue Aug 30, 2023 · 5 comments
Open

Comments

@kysmith-csg
Copy link
Contributor

kysmith-csg commented Aug 30, 2023

I am trying to upgrade our product to use m2e 2.4.0 and running into trouble with the archetype.common bundle which we were previously using.

  1. Trying to launch our product from Eclipse (plugin-based) I am not able to resolve m2e.archetype.common correctly because of missing packages.
image

This is after "Select Required". Manually selecting the org.jdom2 bundle gives a similar message about missing dependencies.

  1. The org.eclipse.m2e.archetype.common plugin in org.eclipse.m2e.feature has fragment=true set, thus Eclipse thinks it is missing. https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.feature/feature.xml#L30
image

I note that I was able to build the product using Tycho on the command line but these issues make it hard to launch from Eclipse.

Please advise on any necessary migration needed after upgrade.

@HannesWell
Copy link
Contributor

This is after "Select Required". Manually selecting the org.jdom2 bundle gives a similar message about missing dependencies.

I assume it complains about missing javax.* or org.w3c.dom or org.xml.* packages which are provided by the JDK?
This is was PDE issue eclipse-pde/eclipse.pde#429, which is fixed with Eclipse 2023-09.

You can try out the current M3 for that release.

2. The org.eclipse.m2e.archetype.common plugin in org.eclipse.m2e.feature has fragment=true set, thus Eclipse thinks it is missing. https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.feature/feature.xml#L30

This is indeed wrong, but I'm not sure if this is a blocking error or not. Can you say that?
In general I wonder why this is written to a feature or if this is actually a unnecessary attribute like unpack or install/download-size, which is actually controlled from the MANIFEST.MF or p2-metadata.

@kysmith-csg
Copy link
Contributor Author

I assume it complains about missing javax.* or org.w3c.dom or org.xml.* packages which are provided by the JDK? This is was PDE issue eclipse-pde/eclipse.pde#429, which is fixed with Eclipse 2023-09.

You can try out the current M3 for that release.

I will try to use the latest PDE, thanks. This makes sense also because I was able to build on the command line and it works fine, just unable to launch from Eclipse unless I select all those dependencies manually.

So yeah, among packages that are missing are javax.xml.stream which I did notice were part of the JDK but somehow PDE didn't think they exist. Can I assume this is why org.jdom2 wasn't selected automatically? Because somewhere down the line some bundle wasn't resolvable? For example, even if I selected org.jdom2 and did "Select Required" it complained about org.jaxen etc.

This is indeed wrong, but I'm not sure if this is a blocking error or not. Can you say that?

I cannot be certain either way, this was just something I noticed while looking through m2e features and plugins. I guess one could remove this, build locally, and see if anything changes. Regardless, it should probably be fixed, because again I'm unsure of the side effects (if it even matters like you said).


One interesting thing was that I tried adding org.apache.maven.archetype.catalog (the package we use) to our Import-Package, but Eclipse complained that no bundle exports these. I had to continue to Require-Bundle: org.eclipse.m2e.archetype.common (I'm slowly trying to move things in our code to Import-Package because I think it's better in many cases). I guess this is because those package exports were added with provider=m2e;mandatory:=provider?

@HannesWell
Copy link
Contributor

Can I assume this is why org.jdom2 wasn't selected automatically?

Very likely yes.

Just in case you didn't do that already: In general it is often easier to manage a product if you just explicitly include the 'root' Features/Plugins you want to use and let PDE/Tycho include all missing requirements automatically:
https://eclipse.dev/eclipse/news/4.24/pde.php#auto-add-requirements-products

One interesting thing was that I tried adding org.apache.maven.archetype.catalog (the package we use) to our Import-Package, but Eclipse complained that no bundle exports these. I had to continue to Require-Bundle: org.eclipse.m2e.archetype.common (I'm slowly trying to move things in our code to Import-Package because I think it's better in many cases).

Its good to migrate to Import-Package. On the long run this makes many thinks simpler.

I guess this is because those package exports were added with provider=m2e;mandatory:=provider?

Exactly, you have to append ;provider=m2e to each imported archetype package.
Looking at the changes of m2e.core.ui maybe helps to get a better understanding of the whole picture:
https://github.com/eclipse-m2e/m2e-core/pull/1494/files#diff-62f67493ba20d6e028679211653bb99a8b2138f21aa55f7eca6aad254c911774

At the moment the error message is silent about that, but we already started an effort to improve that in PDE:

@laeubi
Copy link
Member

laeubi commented Aug 31, 2023

The org.eclipse.m2e.archetype.common plugin in org.eclipse.m2e.feature has fragment=true set, thus Eclipse thinks it is missing.

I already wrote it elsewhere but most (if not all) except of id + version are completely useless and PDE should never use these anyways. So this is more a visual thing than anything that should break something.

HannesWell added a commit to HannesWell/m2e-core that referenced this issue Aug 31, 2023
The Plug-in org.eclipse.m2e.archetype.common is not a Fragment and the
corresponding attribute was added erroneously.

Reported in eclipse-m2e#1537
HannesWell added a commit to HannesWell/m2e-core that referenced this issue Aug 31, 2023
The Plug-in org.eclipse.m2e.archetype.common is not a Fragment and the
corresponding attribute was added erroneously.
This was accidentally added in
eclipse-m2e#1494

Reported in eclipse-m2e#1537
@HannesWell
Copy link
Contributor

2. The org.eclipse.m2e.archetype.common plugin in org.eclipse.m2e.feature has fragment=true set, thus Eclipse thinks it is missing. https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.feature/feature.xml#L30

Created #1540 to remove that (more cosmetic) issue

The org.eclipse.m2e.archetype.common plugin in org.eclipse.m2e.feature has fragment=true set, thus Eclipse thinks it is missing.

I already wrote it elsewhere but most (if not all) except of id + version are completely useless and PDE should never use these anyways. So this is more a visual thing than anything that should break something.

For that I created eclipse-pde/eclipse.pde#730.

HannesWell added a commit to HannesWell/m2e-core that referenced this issue Aug 31, 2023
The Plug-in org.eclipse.m2e.archetype.common is not a Fragment and the
corresponding attribute was added erroneously.
This was accidentally added in
eclipse-m2e#1494

Reported in eclipse-m2e#1537
HannesWell added a commit that referenced this issue Aug 31, 2023
The Plug-in org.eclipse.m2e.archetype.common is not a Fragment and the
corresponding attribute was added erroneously.
This was accidentally added in
#1494

Reported in #1537
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