Skip to content

Commit 6bb72ec

Browse files
kwindavidjgonzalez
andauthored
Fix Service-Component header in manifest (#3337)
* Fix Service-Component header in manifest The broken/incorrectly generated Service-Component header is generated by the Felix SCR Bnd Plugin. Fix it afterwards with the help of a m-shade-p transformer This closes #3241 * Only enable Felix SCR Bnd plugin for main bundle --------- Co-authored-by: david g <[email protected]>
1 parent 18b1eab commit 6bb72ec

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
1010

1111
## Unreleased ([details][unreleased changes details])
1212

13-
## Added
13+
### Added
1414

1515
- #3333 - Use lodash embedded by ACS AEM Commons
1616
- #3323 - Add Provider Type Checker Plugin
1717
- #3338 - Prevent URL modification on dismiss
1818

19+
### Fixed
20+
21+
- #3241 - Fix overlapping Service-Component header entries leading to double registration of components
22+
1923
## 6.6.0 - 2024-04-15
2024

2125
## Added

bundle/bnd.bnd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ Import-Package: \
2020
!org.bouncycastle.jce.*,\
2121
!org.checkerframework.checker.nullness.qual,\
2222
*
23+
# support processing of legacy Felix SCR annotations through the felix.scr.bnd plugin, look at https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.bnd/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java#L60
24+
# paths require special handling: https://bnd.bndtools.org/chapters/820-instructions.html#file
25+
-plugin.felixscr: org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir="$(basedir)/target/classes";log=error
26+
# also detect scr descriptors from bundle fragments (https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#d0e30931)
27+
# this is not properly merged with entries from Felix SCR Bnd plugin, therefore later on patched with m-shade-p
28+
Service-Component: OSGI-INF/*.xml
2329
-classpath: $(basedir)/target/aem-sdk-api-info/

bundle/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@
7676
<plugin>
7777
<groupId>biz.aQute.bnd</groupId>
7878
<artifactId>bnd-maven-plugin</artifactId>
79+
<dependencies>
80+
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd, processes deprecated SCR annotations
81+
with the Bnd process -->
82+
<dependency>
83+
<groupId>org.apache.felix</groupId>
84+
<artifactId>org.apache.felix.scr.bnd</artifactId>
85+
<version>1.9.6</version>
86+
</dependency>
87+
</dependencies>
7988
</plugin>
8089
<plugin>
8190
<groupId>org.apache.maven.plugins</groupId>
@@ -243,6 +252,14 @@
243252
</includes>
244253
</filter>
245254
</filters>
255+
<transformers>
256+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
257+
<manifestEntries>
258+
<!-- overwrite Service-Component again, as incorrectly merged by Felix SCR Bnd Plugin -->
259+
<Service-Component>OSGI-INF/*.xml</Service-Component>
260+
</manifestEntries>
261+
</transformer>
262+
</transformers>
246263
</configuration>
247264
</execution>
248265
</executions>

pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,10 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/
244244
# enable plugins (https://bnd.bndtools.org/instructions/plugin.html)
245245
-plugin.models: org.apache.sling.bnd.models.ModelsScannerPlugin
246246
-plugin.cac: org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
247-
# support processing of legacy Felix SCR annotations through the felix.scr.bnd plugin, look at https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.bnd/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java#L60
248-
# paths require special handling: https://bnd.bndtools.org/chapters/820-instructions.html#file
249-
-plugin.felixscr: org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir="$(basedir)/target/classes";log=error
250247
-plugin.providertype:org.apache.sling.providertype.bndplugin.ProviderTypeScanner
251248
# support only DS 1.4 (https://github.com/bndtools/bnd/pull/3121/files)
252249
-dsannotations-options: version;maximum=1.4.0,inherit
253250
-metatypeannotations-options: version;maximum=1.4.0
254-
# also detect scr descriptors from bundle fragments (https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#d0e30931)
255-
Service-Component: OSGI-INF/*.xml
256251
]]></bnd>
257252
</configuration>
258253
</execution>
@@ -270,13 +265,6 @@ Service-Component: OSGI-INF/*.xml
270265
<artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
271266
<version>1.0.2</version>
272267
</dependency>
273-
<!-- https://github.com/apache/felix/tree/trunk/tools/org.apache.felix.scr.bnd, processes deprecated SCR annotations
274-
with the Bnd process -->
275-
<dependency>
276-
<groupId>org.apache.felix</groupId>
277-
<artifactId>org.apache.felix.scr.bnd</artifactId>
278-
<version>1.9.6</version>
279-
</dependency>
280268
<!-- enforce that provider types are not implemented/extended, https://github.com/apache/sling-org-apache-sling-providertype-bnd-plugin -->
281269
<dependency>
282270
<groupId>org.apache.sling</groupId>

0 commit comments

Comments
 (0)