bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
532 stars 305 forks source link

Bndtools.m2e and e(fx)clipse do not work together in eclipse Photon #2904

Closed babymotte closed 4 years ago

babymotte commented 5 years ago

As described in https://github.com/bndtools/bnd/issues/2895 after updating from eclipse Oxygen to eclipse Photon I got errors on maven projects using the bnd-maven-plugin saying

"Plugin execution not covered by lifecycle configuration: biz.aQute.bnd:bnd-maven-plugin:4.1.0:bnd-process (execution: default, phase: process-classes)"

which also led to the bundle jars in the projects' target folders to not be rebuilt as part of eclipse's incremental builds.

As it turns out, this problem happens if and only if the e(fx)clipse plugin is also installed in the same eclipse instance.

affected eclipse versions: 4.8.0 [1] to 4.10.0 (latest at this point) affected Bndtools versions: 4.0.0 [2] to 4.2.0-SNAPSHOT (latest at this point) affected e(fx)clipse versions: 3.3.0 [3] (latest at this point)

[1] previous versions of eclipse, i.e. Oxygen, were definitely NOT affected, I've been using that combination of plugins for months without any issues [2] 4.0.0 was the version I had installed when first switching to Photon, I never tried to reproduce the issue with an older version of Bndtools [3] only version I have knowingly tested so far, issue may or may not be there in older versions

joerg-wille commented 5 years ago

@bjhargrave you wrote in the mailing list that "Bnd maintainers are getting ready to close down the 4.3 release development with the view to release 4.3 by the end of August". Will this problem still be resolved in 4.3? Best regards, Jörg

bjhargrave commented 5 years ago

@rotty3000 was going to look into this issue. I am not sure any progress has yet been made. So it maybe that this is not going to make 4.3.

eliasvasylenko commented 5 years ago

The conflicting lifecycle error (Edit: as mentioned in #2895) means that something else is also registering an action for the "bnd-process" goal and m2e doesn't know how to disambiguate. I don't think this is really a Bndtools bug.

Presumably e(fx)clipse is pulling in some dependency which is trying to handle the goal and it's conflicting with Bndtools. Searching their repo, I don't think e(fx)clipse is doing it themselves. But a bit of a google shows that e.g. Apache Sling and Liferay IDE both handle this goal, so there are plugins out there which do this, though neither of those examples are pulled in by e(fx)clipse. It could be anything.

Really the bug here is with m2e for not providing a nice UI to allow the user to select which plugin should be used to handle the goal, or even for reporting properly in the error which IDE plugins are conflicting. Poor usability imo.

Anyway, in the meantime a workspace can be fixed up by manually overriding the lifecycle mapping metadata, which can be done via Maven -> Lifecycle Mappings in the preferences window. Just copy in the settings from the bnd plugin to have them take precedence https://github.com/bndtools/bnd/blob/master/bndtools.m2e/lifecycle-mapping-metadata.xml

I suspect a fix can't be made on the plugin end and this will always needs user intervention, but hopefully someone with more m2e experience knows better.

Also note that this workaround might break e(fx)clipse-related projects in the same workspace. Luckily it is workspace-specific though, so as long as you keep e(fx)clipse and Bndtools projects separate you should be able use the same Eclipse install for both.

Edit: changed "fix" to "workaround" ;)

babymotte commented 5 years ago

@eliasvasylenko This works for me. Thanks for the hint!

bjhargrave commented 4 years ago

Bndtools 5.0 has moved to Eclipse 2018-12 as the base Eclipse version.

stale[bot] commented 4 years ago

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Bnd/Bndtools or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.