-
-
Notifications
You must be signed in to change notification settings - Fork 300
Description
Using the latest Bndtools snapshot version in an M2E workspace, the Bnd Run File Editor’s resolver will not take into account the -runee and -runfw directives from bndrun files that are -included into the active file. Instead of the resolution results, an error message is displayed.
This is a regression from Bndtools 7.0.0 where resolution in M2E projects works as expected. Bnd Maven Plugins version 7.1.0 also seem to function correctly.
Previously I reported other issues with the M2E support in Bndtools that emerged since version 7.1.0: #6380 and #6393. The effect of all these issues is that I am forced to downgrade to Bndtools version 7.0.0 to continue working
with M2E workspaces in Eclipse IDE.
Please see also a similar issue #6395 in which it is demonstrated that the GUI resolver in an M2E workspace also ignores -runrequires from included files, which leads to incorrect resolution.
Project setup
I have prepared a reproducer Maven project that builds a minimal Hello World bundle using Bnd Maven Plugins. The project contains a run.bndrun file that runs the bundle with the Eclipse Equinox OSGi framework and debug.bndrun file that includes run.bndrun and adds the Apache Felix Gogo console for debugging. There are no dependencies other than Equinox and Gogo.
Steps to reproduce
- Launch Eclipse IDE 2024-12 with Bndtools version 7.2.0.DEV-202412050913-g8c79789 (installed from https://bndtools.jfrog.io/bndtools/update-snapshot).
- Import the reproducer project: bndtools-resolve-reproducer.tar.gz.
- Open
debug.bndrunin Bnd Run File Editor and choose Run tab in the bottom of the editor. - Click Resolve button.
Actual result
The following error message is displayed in the Resolution Results window:
'Resolve' has encountered a problem.
The OSGi Framework and Execution Environment must be specified for resolution.
This is misleading because the two directives -runee and -runfw are already specified in the included run.bndrun file.
Which is even more important, as explained below, the resolver in the IDE will also ignore -runrequires directives defined in an included bndrun, which leads to incomplete resolutions.
Expected result
There should be no error. A Resolution Results window should open, displaying the required resources used to create the Run Bundles list.
The resulting -runbundles list should include the project’ own bundle and Gogo shell bundles and look like the following:
-runbundles: \
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\
org.apache.felix.gogo.runtime;version='[1.1.6,1.1.7)',\
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\
org.example.bndtools.bndrun.reproducer;version='[1.0.0,1.0.1)'
The command line mvn bnd-indexer:index bnd-resolver:resolve can process the bndrun file correctly and render exactly the above expected result. (The POM is configured to use Bnd Maven plugins version 7.1.0).
Bndtools 7.0.0 can also resolve this file in Eclipse IDE correctly.
Trying to work around the error
Attempting to address the issue without downgrading the Bndtools version, I made changes to the debug.bndrun file and got results that may be interesting for you.
First, to suppress the error about the OSGi framework and Java runtime, I have copied the -runfw and -runee directives from run.bndrun. Resolution ended up in an error:
Resolution failed. Summary:
⇒ Bundle: org.apache.felix.gogo.shell cannot be resolved
Note: The summary above may be incomplete. Please check the full output below for more hints.
Resolution failed. Capabilities satisfying the following requirements could not be found:
[<<INITIAL>>]
⇒ osgi.identity: (osgi.identity=org.apache.felix.gogo.shell)
resolvedebug log: INFO: Using framework org.eclipse.osgi;3.21.0
ERROR: Cannot find framework org.eclipse.osgi;3.21.0
DEBUG: for osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)' found []
DEBUG: for osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)' found []
The resolver could not see a Gogo shell bundle, which is a dependency listed in the POM, and could not find the Equinox framework. This error looks similar to #6393, where it was not able to see the project’s own bundle.
Second, to make all the required bundles visible to the resolver, I specified the index location by adding -standalone: target/index.xml to the bndrun file.
The result of these two edits can be found in debug-standalone.bndrun file. Resolving this file in the Eclipse IDE gives an incomplete -runbundles list which contains only the Gogo shell bundles directly required from this file and not the project’s own bundle required transitively from -include run.bndrun. See the issue #6395 for details.