osgi.service Required-/Provided-Capability no longer generated

223 views
Skip to first unread message

Arnoud Glimmerveen

unread,
Jul 25, 2017, 3:18:44 AM7/25/17
to bndtools-users
Hi all,

I am in the process of updating an existing code base to use a new version of bnd (through updating the maven-bundle-plugin version). The code base I am updating uses Declarative Services where in some projects these are handwritten Component XML files and in others generated from annotations by the maven-scr-plugin.
Before maven-bundle-plugin 2.5.3 was used (Bnd-2.3.0.201405100607) which emitted osgi.service Required/Provided capabilities based on the DS components in the project. I updated the project to the latest available maven-bundle-plugin version 3.3.0 (Bnd-3.3.0.201609221906) and I no longer see theses capabilities being generated.

Has the processing of existing DS XML files towards osgi.service capabilities been removed or do I have to update my Bnd instructions in order for these capabilities to show up again?

Kind regards,

Arnoud.

BJ Hargrave

unread,
Jul 25, 2017, 10:40:23 AM7/25/17
to bndtool...@googlegroups.com
The osgi.service cap/req requirements are generated by bndlib. We have unit tests to verify this.

Cap generation can be disabled with -dsannotations-options: nocapabilities and Req generation can be disabled with -dsannotations-options: norequirements.

I am unsure of how the maven-bnd-plugin configures bndlib.


--
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.
--
BJ

Arnoud Glimmerveen

unread,
Jul 26, 2017, 2:51:05 AM7/26/17
to bndtools-users
Hi BJ,

Thanks for your response. As I understand from the documentation the options you mention are all related to bndlib processing the DS annotations. The codebase I am working on however relies on DS XML files being present before bnd is executed (at packaging phase). Some of the older projects have handwritten DS XML files, whilst others do use annotations, which are processed by Felix's maven-scr-plugin. In both scenario's the Service-Component header and the related resources (files) are supplied to the maven-bundle-plugin using the 'Service-Component' and 'Include-Resource' instructions.

I believe that in Bnd 2.3.0 the SCRAnalyzer would parse any DS XML files supplied to the bnd using the method described above and would generate the osgi.service capabilities. When looking in the source repository I still see the SCRAnalyzer, but it looks like it was moved to a separate tool since version 2.3.0? I can't figure out though if this component can still be used in the way it was working back in 2.3.0?

Any help or thoughts are greatly appreciated!

Kind regards,

Arnoud.

BJ Hargrave

unread,
Jul 26, 2017, 7:47:21 AM7/26/17
to bndtool...@googlegroups.com
2.3.0 is a looooong time ago. I don't know how that class may have changed since then. Of course git has all the history is you feel like an archeological dig! :-)

David Jencks

unread,
Jul 26, 2017, 9:43:50 PM7/26/17
to bndtool...@googlegroups.com
How old is 2.3.0?  The current SCRAnalyzer (./org.osgi.impl.bundle.repoindex.lib/src/org/osgi/service/indexer/impl/SCRAnalyzer.java) git history goes back to 2012 and as far as I know its function has always been to advertise SCR component service capabilities and requirements in  indexes and not to contribute to manifests.  What is the source path for the SCRAnalyzer you’ve found?  I’ve certainly never seen any provide-capability or require-capability headers in manifests before I added the current code working off annotations, and I used various versions of the bnd SCR manifest shorthand expansion before annotations became available.

david jencks

BJ Hargrave

unread,
Jul 26, 2017, 9:45:01 PM7/26/17
to bndtool...@googlegroups.com
Perhaps it was a special analyzer from the maven-bundle-plugin team?

Arnoud Glimmerveen

unread,
Jul 27, 2017, 3:46:56 PM7/27/17
to bndtools-users
Hi BJ,

Upon doing some debugging on my side I found it is indeed an Analyzer from the maven-bundle-plugin. Apparently the ScrPlugin, an Analyzer from the maven-bundle-plugin, was deprecated by the Felix team (FELIX-5047) and disabled by default in the latest maven-bundle-plugin version which I also updated in my 'big project version update'. 
So my issue has nothing to do with bnd. Just for anyone stumbling on the same issue: the plugin is still there and can be enabled with the instruction -plugin org.apache.felix.bundleplugin.ScrPlugin (for as long as the plugin is part of the maven-bundle-plugin and you make sure bnd does not process your DS annotations if present).

Sorry for causing a bit of a confusion here; my memory of three years ago on how this all worked was clearly not as good as I thought!

Thanks for helping me figure this out!

Kind regards,

Arnoud.
Reply all
Reply to author
Forward
0 new messages