jayware / gradle-osgi-ds

Easy to use gradle plugin to generate Declarative Services XML files
Apache License 2.0
2 stars 3 forks source link

when unbindMethod is missing, error during build #5

Closed svatos-jirka closed 7 years ago

svatos-jirka commented 7 years ago

HI,

when unbind method is missing (for example: if reference is STATIC) then I got exception:

Execution failed for task ':generateDeclarativeServicesDescriptors'.

org.apache.felix.scrplugin.SCRDescriptorException: Unable to add methods to com.xxxxx.Service

why? thanks

kKdH commented 7 years ago

Hello,

a STATIC reference does not mean that the reference doesn't get unbound from your service. In terms of OSGi, STATIC means that when the component your service depends on becomes unavailable, the SCR first deactivates your service and than it invokes the appropriate unbind method.

I'm not sure whether the OSGi specification forces you to write an unbind method but the behaviour of the SCRDescriptorGenerator is to throw an exception if the unbind method is missing. The gradle-os-ds plugin only invokes the SCRDescriptorGenerator and passes your classes to it. It doesn't change its behaviour - hopefully! :wink:

Pleas let me know if you tried other tools (e.g. the maven-scr-plugin) to generate service descriptors and got other results.

kKdH commented 7 years ago

If you have more questions or found some indicators that it is really a bug in the gradle-osgi-ds plugin, don't hesitate to open an issue!

svatos-jirka commented 7 years ago

Hello,

you have right. But in most of cases the unbind method doesnt do nothing (just set reference to null). I will double check maven plugin, which generates this unbind method automatically.

with best regards, jiri

2017-08-19 23:43 GMT+02:00 Elmar Schug notifications@github.com:

If you have more questions or found some indicators that it is realy a bug in the gradle-osgi-ds plugin, don't hesitate to open an issue!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jayware/gradle-osgi-ds/issues/5#issuecomment-323549415, or mute the thread https://github.com/notifications/unsubscribe-auth/AIYG0uJrvyPr26gqRyKC9UNwQYi0K3-jks5sZ1cMgaJpZM4O3Xit .