简体   繁体   中英

How use Java ServiveLocator with One-Jar

I'm packaging an application of mine in a single jar using the One-Jar tool:

http://one-jar.sourceforge.net/

It works nike, but I have a problem with a service implemented in a dependency module, which is implemented in a separate jar.

The module uses the standard Java ServiceLoader mechanism to provide its service ie the jar has a file META-INF/services/package.name.ServiceProviderClass which specifies the service concrete class to be instantiated.

BUT when this jar is embedded in the application "fat-jar", created by One-Jar, the the service it is NOT discovered by the service loader mechanism.

Any idea how to make it work?

Cheers, Paolo

At the end I solved this problem by using Capsule packaging in place of One-jar

http://github.com/puniverse/capsule

Enjoy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM