I wanted to build a plugin module that can be loaded with a ServiceLoader. This requires adding a file to the META-INF/services directory, that is named after t
Meanwhile I found a solution to my problem in a (somewhat) similar Question.
Adding the following to the gradle.build file, resolves my problem
jar {
from ('./src/main/java') {
include 'META-INF/services/org.example.plugins.PluginService'
}
}
Now the JAR file looks as expected
.
|- org
| `- example
| `- plugins
| `- impl
| `- ExamplePlugin.class
`- META-INF
|- MANIFEST.MF
`- services
`- org.example.plugins.PluginService