-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Case
When a fat-jar is created with maven following the current documentation and using multiple additional formats causes errors relate with that maven take only the first META-INF.services declared from the dependencies.
eg:
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-config</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-config-yaml</artifactId>
<version>${vertx.version}</version>
</dependency>
The io.vertx.config.spi.ConfigProcessor will be from the verxt-config ignoring the implementations from the yaml-lib
Two suggestions:
-A. Update readme relate to far-jars to acknowledge the user that uses maven with maven-shaded-plugin that needs to use the ServicesResourceTransformer to merge all the ServicesResource
-B. Instead of each vertx-confi-{type} have their own io.vertx.config.spi.ConfigProcessor/ConfigStoreFactory update the core with all the Implementations.
A. Update Doc
Update https://vertx.io/docs/vertx-config/java/ telling to the user that when is create a fat-jar with maven-shade-plugin and additionals formats is needed to be define an extra transformer
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
Otherwise they only with keep with the last service that can have missing some Implementation given to the user errors like
java.lang.IllegalArgumentException: unknown configuration format: yaml (supported formats are: [json, raw, properties]
B. Move implementations declarations to core-lib
The vertx-config keeps all the implementations on her own META-INF and remove from the others additional-formats
eg
[...]
# Bases
io.vertx.config.impl.spi.JsonProcessor
io.vertx.config.impl.spi.RawProcessor
io.vertx.config.impl.spi.PropertiesConfigProcessor
# Extended
io.vertx.config.git.GitConfigStoreFactory
io.vertx.config.yaml.YamlProcessor
[...etc]
The previous suggestion is the "correct" one, but this other provides to the user an easy error to follow
ERROR i.v.c.i.l.c.VertxIsolatedDeployer - Failed in deploying verticle java.util.ServiceConfigurationError: io.vertx.config.spi.ConfigProcessor: Provider {reference} not found
ERROR i.v.c.i.l.c.VertxIsolatedDeployer - Failed in deploying verticle java.util.ServiceConfigurationError: io.vertx.config.spi.ConfigStoreFactory: Provider {reference} not found