Skip to content
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

Update Doc relate to additional formats or move implementations to core-lib META-INF/services #145

Open
riojano0 opened this issue Apr 20, 2022 · 2 comments

Comments

@riojano0
Copy link

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
@gaol
Copy link
Member

gaol commented Apr 21, 2022

I prefer the option A, to mention that in the doc, would you like contribute ? 😄

BTW, if you use https://start.vertx.io/, it has <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> defined to produce the fat jar.

@riojano0
Copy link
Author

Something like this?,
#146
Please check my English is not the best

I missed checking the one created by the starter application, but nice that already have it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants