When trying to debug under OSGI in Eclipse using the bnd Eclipse plugins, I have the problem that sources are not obtained through either the Eclipse workspace or through Maven source JARs related to the bundles that I am trying to debug. Instead, I get a message like error downloading source: bundle x.y.z.source:1.2.3 does not exist in this workspace. I assume “workspace” here refers to the BND workspace and not to the Eclipse workspace. And I did not find any information on how to generate these “…source” bundles. Any pointers?
As a workaround, I currently have to have projects with the relevant source open in the Eclipse workspace and manually add them to the source lookup in every debug run.
What build tool do you use to build your projects from the command line; maven, gradle (bnd standalone gradle plugins) or bnd’s proprietary workspace (+ gradle)?
For some bundles, I use the maven-bnd-plugin and for others I use the maven-bundle-plugin. It doesn’t seem to matter though, as in Eclipse, the sources of neither of these can be resolved.
But anyway, since I’m working in Eclipse and I have the projects even open in Eclipse, most of the projects get resolved from the Eclipse workspace - and I would expected their sources to be resolved from there as well.
I’ve never experienced M2e not resolving resources for maven projects regardless of which packaging plugin was being used. That should actually fall on M2e’s integration with (I believe) the maven resource plugin. Perhaps if you shared a reproducer project we might be able to spot something out of place?
Btw. this is what I get when I press “Edit lookup path” after trying to open a file in the debugger that has no source attachment. As you can see, for most of the bundles (and this even includes bundles obtained from Maven Central) no sources can be found. Oddly, for some like assertj, they can be found. Source resolving for the same JARs works flawlessly when running my code just as plain Java without OSGI e.g. as plain JUnit tests (i.e. without runbnd).
To be honest I haven’t tried this recently in I know there were some Bnd/M2e issues due to M2e API changes that bnd only recently addressed. I wonder if this is a regression. All I can suggest is that you update Eclipse, update M2E, and update bnd m2e integration all to their latest and see what happens (if that’s not already the state you’re in).