Hello Steiner,

I have done the same for keycloak. Hope this helps.

Please see the attached PR.
https://github.com/keycloak/keycloak/pull/9288/files

- Christian


> Am 13.08.2023 um 10:05 schrieb Steinar Bang <s...@dod.no>:
> 
> I am trying to make a PR for OSGi-ifying the TwelveMonkeys library.
> https://github.com/haraldk/TwelveMonkeys/issues/794
> 
> TwelveMonkeys is a pure-java implementation of image format readers and
> writers for many graphics formats.
> 
> TwelveMonkeys plugs into the Java runtime ImageIO system, using the
> Service Provider Interface (SPI).
> https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/imageio/package-summary.html
> 
> I'm already using the SPI with liquibase with Aries SPI Fly, so I
> figured it must be possible to make SPI work for TwelveMonkeys and
> ImageIO as well.
> 
> But I have so far been unsuccessful in determining how the
> <Provide-Capabilities> and <Require-Capabilities> instructions to
> maven-bundle-plugin should look like.
> 
> Does anyone know?
> 
> My latest attempts are:
> 
> When creating the bundle with the plugin:
> 
> <plugin>
>    <groupId>org.apache.felix</groupId>
>    <artifactId>maven-bundle-plugin</artifactId>
>    <configuration>
>        <instructions>
>           <Provide-Capability>
>               osgi.serviceloader;
>               
> osgi.serviceloader=com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader
>            </Provide-Capability>
>        </instructions>
>    </configuration>
> </plugin>
> 
> 
> When using the bundle with the plugin from a different bundle:
> 
> <plugin>
>    <groupId>org.apache.felix</groupId>
>    <artifactId>maven-bundle-plugin</artifactId>
>    <configuration>
>        <instructions>
>            <Require-Capability>
>                osgi.extender; 
> filter:="(osgi.extender=osgi.serviceloader.processor)",
>                osgi.serviceloader; 
> filter:="(osgi.serviceloader=com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader)";
>  cardinality:=multiple,
>            </Require-Capability>
>        </instructions>
>    </configuration>
> </plugin>
> 
> But this gives me many error messages in the integration test (and when
> loading into karaf): 
> https://gist.github.com/steinarb/55d4814e000e6e4e2f2a6235c3a186ae
> 
> Suggestions are welcome!
> 
> Thanks!
> 

Reply via email to