I am building a plugin and I would like to register some services for it but so far I have been unable to achieve this. From what I’ve see in Gradle’s source code (e.g. PublishServices, to register services we need to:
- Create a class that extends a org.gradle.internal.service.scopes.AbstractPluginServiceRegistry (or implements PluginServiceRegistry?)
- Override any of the service registry methods adding our defined providers
- Add a file in
src/main/resources/META-INF/services/with the name of the interface
org.gradle.internal.service.scopes.PluginServiceRegistryand add the name of the our class (e.g.
Am I missing any steps? Do I have to activate it or register it when the plugin is activated? How do I know if it has indeed been activated? I have added some logs in the registry methods’ body but I haven’t seen them appear anywhere…