Skip to content

Commit 2235d3c

Browse files
authored
Fully automate OSGi metadata creation and fix brocken OSGi-metadata in slf4j-api (#330)
* Improve generated OSGi metadata and restore Bundle-SymbolicName Enhance the generated OSGi metadata for all slf4j-modules in the following ways: - Restore the Bundle-SymbolicName, Bundle-Name, Bundle-Vendor and Bundle-DocURL from SLF4J-2.0.5 and before - Removes Export-Package: META-INF.versions.9 - Removes self-Imports of exported package (has to be added again in a follow up, where desired) - Remove unnecessary BND-internal headers Additionally move the maven-bundle-plugin configuration from the execution configuration up into the configuration of the plugin so that it can be easier overwritten in child-modules. Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net> * Automate OSGi metadata creation and restore package-exports of slf4j-api Only use the maven-bundle-plugin to generate all OSGi metadata into slf4j-api's Manifest.MF file. This unifies the resulting MANIFEST.MFs that are currently partly generated and partly statically defined. Furthermore it fixes the following flaws in the currently generated OSGi metadata of slf4j-api: - Import only the exported org.slf4j.spi package (like in slf4j 2.0.5 and before) - Replace the deprecated 'Bundle-RequiredExecutionEnvironment' header by a corresponding required 'osgi.ee' capability Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net> --------- Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
1 parent a5540ad commit 2235d3c

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

pom.xml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,32 @@
241241
<groupId>org.apache.felix</groupId>
242242
<artifactId>maven-bundle-plugin</artifactId>
243243
<version>${maven-bundle-plugin.version}</version>
244+
<configuration>
245+
<supportIncrementalBuild>true</supportIncrementalBuild>
246+
<!-- populated by the plugin itself -->
247+
<instructions>
248+
<Bundle-SymbolicName>${replacestring;${project.artifactId};-;.}</Bundle-SymbolicName>
249+
<Bundle-Name>${project.artifactId}</Bundle-Name>
250+
<Bundle-Vendor>SLF4J.ORG</Bundle-Vendor>
251+
<_snapshot/>
252+
<_exportcontents>!META-INF.versions.9,*;-noimport:=true</_exportcontents>
253+
<Bundle-Description>${project.description}</Bundle-Description>
254+
<Bundle-DocURL>${project.url}</Bundle-DocURL>
255+
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
256+
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
257+
<Implementation-Version>${project.version}</Implementation-Version>
258+
<Implementation-Title>${project.artifactId}</Implementation-Title>
259+
<Multi-Release>true</Multi-Release>
260+
<_removeheaders>Private-Package,Bundle-SCM, Bundle-Developers, Include-Resource</_removeheaders>
261+
</instructions>
262+
</configuration>
244263
<executions>
245264
<execution>
246265
<id>bundle-manifest</id>
247266
<phase>process-classes</phase>
248267
<goals>
249268
<goal>manifest</goal>
250269
</goals>
251-
<configuration>
252-
<instructions>
253-
<!-- populated by the plugin itself -->
254-
<Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
255-
<Bundle-Description>${project.description}</Bundle-Description>
256-
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
257-
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
258-
<Implementation-Version>${project.version}</Implementation-Version>
259-
<Multi-Release>true</Multi-Release>
260-
</instructions>
261-
</configuration>
262270
</execution>
263271
</executions>
264272
</plugin>

slf4j-api/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@
5353
</executions>
5454
</plugin>
5555

56+
<plugin>
57+
<groupId>org.apache.felix</groupId>
58+
<artifactId>maven-bundle-plugin</artifactId>
59+
<configuration>
60+
<instructions>
61+
<Import-Package>org.slf4j.spi;version="${range;[===,+);${version;===;${maven_version;${project.version}}}}"</Import-Package>
62+
<Require-Capability><![CDATA[
63+
osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.processor)(version>=1.0.0)(!(version>=2.0.0)))",
64+
osgi.serviceloader;filter:="(osgi.serviceloader=org.slf4j.spi.SLF4JServiceProvider)";osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider"
65+
]]></Require-Capability>
66+
</instructions>
67+
</configuration>
68+
</plugin>
69+
5670
</plugins>
5771

5872
</build>

slf4j-api/src/main/resources/META-INF/MANIFEST.MF

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy