Debugging third party bundles

27 views
Skip to first unread message

t...@quarendon.net

unread,
Jul 18, 2016, 8:25:28 AM7/18/16
to bndtools-users
Probably my biggest frustration around using bndtools is seeing source of third party bundles, and stepping into those bundles to understand what's going on.

My suspicion is that this only really works for bundles that have source code in the OSGI-OPT folder within the jar.

Situation that I normally face is something like this. I want to see source code associated with a bundle, something like jackson, or current apache derby.
They don't have source within the jar, in common with 99.9% of bundles I come across on maven central.
So hunt around for the source jar. This usually takes the form of going to mvnrepository, doing to the directory listing containing the download artefacts and manually downloading the source jar. I can then use the "attach source" in eclipse to connect the the together.
This is fine, and allow me to click on a symbol and navigate to the source within the bundle. 

However. Try stepping into that same method during debugging, and eclipse complains it doesn't have any source. 
I get the editor window that says "source not found. Edit source lookup path...". Follow that link ("edit source lookup path") and I get an unfathomable dialog that looks like it might help, but really doesn't seem to. I played with it once, and decided it was a Really Bad Idea, as I lost ALL source lookup completely. Luckily the "Restore Default" button seems to work.

So is my experience expected? 
Why are there apparently two methods for attaching source, one that's used at "edit time", and one that's used a debug time?


Christian Schneider

unread,
Jul 18, 2016, 8:59:45 AM7/18/16
to bndtool...@googlegroups.com
I agree this is a big problem. I wonder how m2e attaches the source for maven artifacts and if the same could be applied to the bndtools launcher.

Peter told me he tries to solve this by creating bundles on the fly that embed the source but I think the m2e way might be more elegant if it works.

Christian
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Peter Kriens

unread,
Jul 18, 2016, 9:07:28 AM7/18/16
to bndtool...@googlegroups.com
Newer repositories like JPM have an ‘Add Sources’ context menu on the bundle which will search maven central and automatically attach the source.

Kind regards,

Peter Kriens

t...@quarendon.net

unread,
Jul 18, 2016, 9:09:23 AM7/18/16
to bndtools-users
This is definitely my biggest productivity issue using bndtools. 

With a plain maven eclipse project, it all just works. Add a maven dependency, it downloads the jar, source and javadoc, attaches them all appropriately together, you can navigate and you can debug, all seamlessly. You need to be able to do the same in bndtools, no question.

t...@quarendon.net

unread,
Jul 18, 2016, 9:20:18 AM7/18/16
to bndtools-users


On Monday, 18 July 2016 14:07:28 UTC+1, pkriens wrote:
Newer repositories like JPM have an ‘Add Sources’ context menu on the bundle which will search maven central and automatically attach the source.


That works in so far as I don't have to manually download things and "attach sources", so great, that's an improvement (doesn't work for derby, bu for some reason there are no sources on maven for that, so that's not your fault).
Debugging isn't helped though. I still get the unfathomable "edit source lookup path...".


t...@quarendon.net

unread,
Jul 18, 2016, 10:04:36 AM7/18/16
to bndtools-users


On Monday, 18 July 2016 14:20:18 UTC+1, t...@quarendon.net wrote:

That works in so far as I don't have to manually download things and "attach sources", so great

Any reason why it can't do this by default?

I take it that the small "+" at the end of the version entry in the repository explorer means "you've done that thing with the sources". Took me a while to spot that to tell which bundles I'd done that to and which I hadn't.

 

Greg Amerson

unread,
Jul 18, 2016, 10:24:20 AM7/18/16
to bndtool...@googlegroups.com
Hey Tom,

Regarding "Edit source lookup path.." I have a possible fix for that issue here: https://github.com/bndtools/bndtools/pull/1435

Is there any way that you could share a small repo that demonstrates the problem you are having with source lookup (or just simple set of steps you are using to reproduce that error)?  And I can take a look to see if my PR fixes that issue or if perhaps it could be modified to address this issue.

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

t...@quarendon.net

unread,
Jul 18, 2016, 11:27:36 AM7/18/16
to bndtools-users


On Monday, 18 July 2016 15:24:20 UTC+1, Gregory Amerson wrote:
Is there any way that you could share a small repo that demonstrates the problem you are having with source lookup (or just simple set of steps you are using to reproduce that error)?  And I can take a look to see if my PR fixes that issue or if perhaps it could be modified to address this issue.


Try breaking on BarImpl.doit, then stepping into the ObjectMapper constructor. 

Greg Amerson

unread,
Jul 18, 2016, 11:35:24 AM7/18/16
to bndtool...@googlegroups.com
Thanks, did you do "add sources" to one of the dependent bundles in the Repositories View?  I just want to make sure I follow the same steps to reproduce the problem.

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

t...@quarendon.net

unread,
Jul 18, 2016, 2:37:13 PM7/18/16
to bndtools-users


On Monday, 18 July 2016 16:35:24 UTC+1, Gregory Amerson wrote:
Thanks, did you do "add sources" to one of the dependent bundles in the Repositories View?  I just want to make sure I follow the same steps to reproduce the problem.

Well that's an interesting question. 
No, I didn't. Yet it has sources.I thought that was odd when I set the workspace up, but didn't give much further thought.

Are the things from Central cached globally (somewhere in ~/.bnd or somewhere similar)? If they are they that would explain it, as I have certainly done an "add sources" on those bundles from other workspaces on the same machine. That's the only explanation I can think of. 

Raymond Auge

unread,
Jul 18, 2016, 3:08:50 PM7/18/16
to bndtool...@googlegroups.com
When using the MavenBndRepository the data is actually stored inline with your local repository (i.e. ~/.m2) so that would certainly explain it.

Furthermore, there was a small flaw in the bnd data stored in the local repository which may affect some use cases with poorly packaged osgi bundles. Therefore it may be useful to run a delete operation similar to:
cd ~/.m2/repository
find -name .bnd -exec rm -rf '{}' +
as outlined in this issue: https://github.com/bndtools/bnd/pull/1512

Note this change is not yet part of a release of BND so you'd need to move to the travis builds to get that.

- Ray

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Raymond Augé (@rotty3000)
Senior Software Architect Liferay, Inc. (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance (@OSGiAlliance)
Reply all
Reply to author
Forward
0 new messages