-
Notifications
You must be signed in to change notification settings - Fork 114
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
#439 - Adopt PDE configurations for maven-bundle-plugins #440
Conversation
5d306a2
to
70dbb2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to check with IP team whether it's fine to just pick some other EPL code here.
I'm a bit worried about the file with missing copyright header being a blocker.
...se.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java
Show resolved
Hide resolved
Whenever new code that is not submitted by author and is not coming from project governed by EF a CQ has to be open. Please open new one of type Project Content (Content to be maintained by an Eclipse Foundation Project) and refer to this PR. |
The CQ require PMC approval: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=23882 |
if @fbricon responsible for PMC for m2e? Can we ping someone else if not? |
add initial code contribution and project setup Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
Is it necessary to place the connector in a dedicated plug-in project? |
I think it is not strictly necessary but I don't see a reason why a dedicated plugin would harm here. Even though its unlikely if one likes to have the maven-bundle support but not the target support it could be installed separately. |
I don't consider it harmful as well. |
I don't think any "count" is a valid measure of putting code into separate plugins. Especially when it comes to (semantic) versioning, smaller items are generally better than bigger ones. Just because both contribute to PDE don't make them related. The target part contributes to the target handling of pde and this contributes to the m2e connectors so this are two separate concerns that should be live in separate plugins. |
That also makes sense. |
probably yes, but this would require using some kind of patch feature to make P2 aware of it (I have never used that) so for now I won't complicate it too much just for the sake of naming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested it with a little Maven-project that uses the maven-bundle-plugin:manifest goal and it worked very well.
There is just an error markers in the Dependencies-Tab of the Manifest-Editor, even tough the plug-in/package from the Maven-project was proposed by the Add... dialogues (for Require-Bundle and Import-Package). So I think this is an PDE issue.
I also like the warnings, in the POM regarding the missing configuration. This is very helpful.
Some parts of the code could be simplified using present-day Java-11 methods. But I think this should be done in a subsequent PR, so that the initial move to Eclipse has as few changes as possible and we get a more clear git-history.
For the installation process an Which gives me another question: Is the code in this new |
I consider none of the code in Don't know if one could mark a bundle as "internal" but I really don't like these eclipse extension as they are extremely confusing and against OSGi principles. |
Will you take a look at this? I sometimes noted that PDE also marks bundles with unresolved requirements with such an error marker, e.g. if your maven-bundle import-package a dependency but this is not available at the current target platform (I opened Bug 577605 for such cases). If you double click the bundle it should open the manifest and show if there is any unresolved package. |
Yep exactly main goal is to get the code in even though it seems we would have been faster If I have rewritten it from scratch as it seem no one of the PMC likes to approve the CQ :-( |
Are you referring to the package name element .internal. or the Manifest header-arguments However I have noticed that this plug-in does not export its only package so it is not public (regardless of the name), so sorry for the disturbance in this regard. To keep the off-scope discussion about o.e.m2e.pde out of this PR I have created #454, we should continue there if there is more to say. |
I can, but at the moment I have too many other things on my list (in my mind), that I would like to do before. So if this flaw persists and nobody else takes care of it, I can do it later :)
Aren't @akurtakov and @vogella in the Eclipse PMC? Could you be so kind and have a look at this or refer to somebody else from PMC? |
m2e is a project under technology. PMC members for Technology are listed at https://projects.eclipse.org/projects/technology/who . |
Thanks Mickael for that hint, I already wondered if there is more than one PMC, because I have the impression that the term Project is used redundantly. So could @guw, @caniszczyk or @waynebeaton be so kind and have a look at the associated CQ at |
org.eclipse.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/Activator.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this PR with the pure Maven m2e's maven-runtime projects as proposed in PR #466 and found one problem with clean and full builds:
In the beginning of a clean/full build the target/classes
folder is purged and with it the META-INF/MANIFEST.MF file located within it. At the same time target/maven-bundle-plugin/org.apache.felix_maven-bundle-plugin_manifest_xx
is not touched. Consequently the manifest
Mojo does not re-generate the MANIFEST.MF in the build when supportIncrementalBuild is enabled, because the mojo only checks org.apache.felix_maven-bundle-plugin_manifest_xx
and not if the MANIFEST.MF is present.
To workaround this, org.apache.felix_maven-bundle-plugin_manifest_xx
has to be target/maven-bundle-plugin
in each clean/full build before the manifest
Mojo is executed.
@@ -2,7 +2,7 @@ | |||
<feature | |||
id="org.eclipse.m2e.pde.feature" | |||
label="%featureName" | |||
version="1.19.0.qualifier" | |||
version="1.20.0.qualifier" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minor version of m2e itself (i.e. the m2e-sdk feature) should also be bumped to be 20.
Actually I expected the tycho-p2-extras-plugin:compare-version-with-baselines goal to consider minor and major versions too.
} | ||
|
||
private boolean isFelixBundleGoal(MojoExecution execution) { | ||
return FELIX_MANIFEST_GOAL.equals(execution.getGoal()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is actually misleading because it checks on the manifest
goal. A name like isFelixManifestGoal()
would be more suitable.
...se.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java
Show resolved
Hide resolved
I think this is a bug in the Felix Bundle plugin, if you agree, would you mind to open a ticket at felix (and maybe provide a PR to fix this)? |
Fully agree that this is a bug in the Felix |
I won't mind to only support latest version given that this was flawed before and we have only limited dev-resources. I even don't see a reason to use old versions of the bundle-plugin... We should also not complicate the code with to much else/if/workaround/... and simply tell people when complain to use always the latest version of the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
manifest
Mojo does not re-generate the MANIFEST.MF in the build when supportIncrementalBuild is enabled, because the mojo only checksorg.apache.felix_maven-bundle-plugin_manifest_xx
and not if the MANIFEST.MF is present.I think this is a bug in the Felix Bundle plugin, if you agree, would you mind to open a ticket at felix (and maybe provide a PR to fix this)?
I opened issue Apache FELIX-6493 and submitted PR apache/felix-dev#124. Fell free to review it.
With those fixes the suggested workaround is not necessary any more and the manifest generation works well and even the error markers at the Maven-OSGi-Projects in the Manifest-Editor dependencies tab respectively the Target-Platform-State view magically vanished (I'm not sure why exactly and if this is permanently).
But if if this is fixed only future versions of the
maven-bundle-plugin
will work correctly.I won't mind to only support latest version given that this was flawed before and we have only limited dev-resources. I even don't see a reason to use old versions of the bundle-plugin... We should also not complicate the code with to much else/if/workaround/... and simply tell people when complain to use always the latest version of the plugin.
I agree that we should not make it too complicated and a workaround is not necessary, but I think a warning would make the user experience much better. Especially because it could take some time until the new maven-bundle-plugin is available and is widely adopted. I think it would be a pity if this great feature would not work in the beginning and users first have to search the internet for a solution while we could simply give them a hint with a corresponding warning. :)
...se.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java
Show resolved
Hide resolved
if (problems.size() > 0) { | ||
this.markerManager.addErrorMarkers(request.getPom(), IMavenConstants.MARKER_LIFECYCLEMAPPING_ID, problems); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code does not consider that the resource of a problem could be the parent pom (or grand-parent etc.).
The following suggestion does consider this.
if (problems.size() > 0) { | |
this.markerManager.addErrorMarkers(request.getPom(), IMavenConstants.MARKER_LIFECYCLEMAPPING_ID, problems); | |
} | |
if (!problems.isEmpty()) { | |
IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry(); | |
for (MavenProblemInfo problem : problems) { | |
String[] gav = problem.getLocation().getResourceId().split(":"); | |
IFile pom = projectManager.getMavenProject(gav[0], gav[1], gav[2]).getPom(); | |
markerManager.addErrorMarker(pom, IMavenConstants.MARKER_LIFECYCLEMAPPING_ID, problem); | |
} | |
} |
IMarker.SEVERITY_WARNING, location); | ||
problems.add(problem); | ||
} | ||
hasManifestExecution = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following code would give the user a warning to use the latest Maven-Bundle-Plugin (assuming the mentioned fixes will be integrated there). Maybe the message could be better.
hasManifestExecution = true; | |
MavenVersion version = MavenVersion.parseMavenString(execution.getPlugin().getVersion()); | |
if (version != null && version.toReleaseVersion().compareTo(new MavenVersion("5.1.4")) < 0) { | |
SourceLocation location = SourceLocationHelper.findLocation(execution.getPlugin(), "version"); | |
problems.add(new MavenProblemInfo( | |
"The Maven-Bundle-Plugin only integrates well with Eclipse-M2E with version 5.4.0 or later", | |
IMarker.SEVERITY_WARNING, location)); | |
} | |
hasManifestExecution = true; |
I think we can at least add a warning marker for older version and suggest an upgrade. But for such improvements I really want to wait until EMO approval of the code. |
That's now good to merge from a legal POV according to recent comment on the CQ. |
@HannesWell I'll merge this as-is now, so the code is in the repository can you create separate PR(s) for your enhancements? |
- add warnings about missing configuration options - support bnd-bundle plugin as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HannesWell I'll merge this as-is now, so the code is in the repository can you create separate PR(s) for your enhancements?
Yes, please go ahead. I'll create a PR afterwards.
This add initial code contribution and project setup to m2e. This code is copied from (with slight adjustments e.g. package name and constant inlining):
both files are EPL 1.0 and the contribution is below 1000 LOC (including configuration files), so I would assume no IP review is required, but like to get a verification by @mickaelistria and @fbricon as project lead.
If the legal part is done I'd like to test and maybe enhance the code later on, e.g. currently I have only used it with felix plugin but the same should apply to the bnd-bundle plugin.