Closed kwin closed 2 months ago
You find an example where it is merged in https://github.com/Adobe-Consulting-Services/acs-aem-commons/tree/master/bundle while for https://github.com/Adobe-Consulting-Services/acs-aem-commons/tree/master/bundle-cloud it isn't (although both modules contain Declarative services and share most of the bnd configuration from https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/e2c2bfaf5107e768f87cc6d145dccb0a31cd6a62/pom.xml#L255
I looked at the code and it did exactly what should be done imho: it should remove any path that the annotations like to add but overlaps with a wildcard defined in the bnd file.
Notice that this is quite different from the Import-Package case. With the I-P case, all wildcarding is done by bnd while in the Service-Component case the wildcarding happens in runtime (and thus can take fragments into account).
Can you make a small github repo (or bnd test case) with an example where this occurs in a way you don't agree with?
Sorry for the noise, turned out that this bnd plugin is to blame here: https://github.com/apache/felix-dev/blob/81edc6e48db29feae5d0deb0af23719f50ddcb2b/tools/org.apache.felix.scr.bnd/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java#L212. The DSAnnotations
plugin behaves as expected.
I assume you used 'apache felix' instead of 'bnd' :-)
Thanks for letting us know.
I used a Felix Bnd plugin together with bnd-maven-plugin ;-). FTR: Apache Felix SCR will be more lenient with duplicate Service-Component
entries in the future: https://issues.apache.org/jira/browse/FELIX-6699
It seems that under certain circumstances the explicit value of
Service-Component
being set in the bnd file gets merged with the values being retrieved by theDSAnnotations
plugin (https://github.com/bndtools/bnd/blob/79dad59d406f627e2f0eb612909ef78fc904570f/biz.aQute.bndlib/src/aQute/bnd/component/DSAnnotations.java#L143C4-L143C18).This does not really work if I put something like this in my bnd file
(for example to also detect service components from attached bundle fragments). This should obviously not be merged with other values (as it already covers them and otherwise leads to duplicate registration of components).
I would expect the
Service-Component
to behave similarly asImport-Package
i.e. disregard the automatically calculated value except if*
is explicitly being used (https://bnd.bndtools.org/releases/4.0.0/heads/import_package.html).There seem to be edge cases where it does work as expected (i.e. the explicit value takes precedence and overwrites the implicit values).