0

I have a shared library which has a class that implements org.eclipse.microprofile.config.spi.ConfigSource (let's call this CustomConfigSource.java). In the shared library's META-INF/services folder there is a file called "org.eclipse.microprofile.config.spi.ConfigSource" which contains the path to my CustomConfigSource.java class. This way I can use that class as an alias for eclipses' microprofile config in any child project that inherits the shared library.

In my child project I have added the shared library as a dependency. What I want to do is extend the CustomConfigSource class from my shared library and create a class called CustomConfigSourceChild.java. In order to use CustomConfigSourceChild as an alias for eclipse's microprofile config in my child project, I need to add the path to CustomConfigSourceChild.java in the child project's META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource file.

So in other words, here is what my shared library's resources folder structure looks like:


├── META-INF
│   └── services
│       └── org.eclipse.microprofile.config.spi.ConfigSource

And my child project's resources folder:


├── META-INF
│   └── services
│       └── org.eclipse.microprofile.config.spi.ConfigSource

Both my child project's and my shared library's org.eclipse.microprofile.config.spi.ConfigSource file contains the path to their respective custom config source implementation java file.

Now here is the issue. When I compile my child project (mvn clean package), in my child project's target/META-INF/services/, ideally I should see both the paths to CustomConfigSource.java and CustomConfigSourceChild.java. However, this is not the case, as I only see the path to CustomConfigSource.java included.

I tried fixing this issue by adding the following maven-shade-plugin:

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Which ideally should merge both META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource files from the shared library and child project, but this did not work.

Any suggestions on how to merge both META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource files from shared library and child project?

swing1234
  • 233
  • 1
  • 3
  • 13
  • Please try to create an [mre], this will help to understand/reproduce and hopefully fix the issue. – xerx593 Apr 30 '23 at 21:22

1 Answers1

1

Helidon doesn't support building fat/uber jar.