I haven't dug into spi-fly for a while, can you point me which part of its code handle declared capabilities so I can have a look? My basic understanding of Provide and Require-Capability headers is that these are primarily hints for osgi resolver to gather dependencies on layer other than import/export packages.

Best,
Łukasz

On 13.08.2023 21:27, Steinar Bang wrote:
Steinar Bang <[email protected]>:

Still doesn't work:
  https://gist.github.com/steinarb/8bb77c64562bd853fc95a3fb19cfb5cf

But when I look closer at those error message it may be as simple as
lacking a run time dependency that can provide the package
com.twelvemonkeys.imageio...?

And that seems to be the case with the previous load error message as
well:
  https://gist.github.com/steinarb/55d4814e000e6e4e2f2a6235c3a186ae

Update for those following the thread: after adding compile scope maven
dependencies (which adds them to the karaf feature of the bundle using
them and makes them available at runtime), the load errors went away.

But the application running in karaf still uses the default JPEG reader,
and not the twelvemonkeys JPEG reader, so the SPI stuff hasn't kicked
in.

I have tried with <Require-Capability> loading the osgi.serviceloader,
and it fails to load, even when I explictly load Ares SPI Fly (which
already should be loaded, because liquibase requires it).

And when I remove the <Require-Capability>, as said above, ImageIO uses
the default JPEG reader, which means the twelvemonkey plugin hasn't
registered.

The code definining <Require-Capability> looks like this:

modified   imageio/pom.xml
@@ -170,4 +170,22 @@
              </dependency>
          </dependencies>
      </dependencyManagement>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <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.extender=osgi.serviceloader.registrar)"
+                            </Require-Capability>
+                        </instructions>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
  </project>

Ideas for how to correct this into something that would wor, would be
gratefully accepted.

Thanks!

Reply via email to