New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ability to generate META-INF/services/* from module-info #136
Comments
IMHO a feature like this requires parsing the module information and determine the services exposed. As an alternative you may use an annotation processor to generate the required service files, albeit there will be some sort of duplication as you need both the module definition and the annotated service. There are handful of annotation processors that can do the job:
Personally I chose Jipsy (I'm the maintainer so I'm biased). Here's how I put it to work on the Ikonli build https://github.com/kordamp/ikonli/blob/master/icon-packs/ikonli-fontawesome-pack/src/main/java/module-info.java |
Thanks for your hint. That is interesting. As I still have to maintain services in the |
How are you defining your module-info descriptor? If you generate it via
ModiTect, it will pick up all class service definitions and expose them as
"provided" services. We could think of doing it the other way around too.
Happy to accept a PR if you feel like giving it a try.
… |
I have alredy migrated my entire OSS project (https://github.com/m-m-m) to JPMS/jigsaw and it works great.
I am using service-loader for dynamic and flexible plugin/extensions mechanism and declare the implementations in my
module-info.java
files (see e.g. https://github.com/m-m-m/property/blob/master/core/src/main/java/module-info.java#L23).However, when my modules are not loaded via module-path but via legacy classpath the
module-info
is not loaded and therefore services are not discovered.To workaround this problem, one can manually add legacy
META-INF/servicess/«api-fqn»
files and list the implemenations there (see e.g. https://github.com/m-m-m/ui-tvm/blob/master/core/src/main/resources/META-INF/services/io.github.mmm.property.factory.PropertyFactory).However, maintaining this manually as redundant files is kind of tedious. It would therefore be awesome to have some maven-plugin that could generate this automatically during the build from
module-info.java
. I searched if such solution is already available and stumbled over your plugin.So with this issue I want to kindly ask if you would consider this as a suitable and valuable feature for your project (since you were asking for
YOUR ideas :)
).If so please get in touch. If you want I could even contribute via PR.
The text was updated successfully, but these errors were encountered: