I have written some code that uses some resteasy libraries.
The code works fine in Eclipse but produces exceptions when excecuted as fat-jar build with the maven sha
The accepted answer is correct, but is for Maven's Shade plugin. If you're using Gradle's Shadow plugin, you must merge service descriptor files.
Using Gradle's Kotlin DSL:
tasks {
withType<ShadowJar> { mergeServiceFiles() }
}
Using Gradle's Groovy DSL:
shadowJar { mergeServiceFiles() }
Ok, i found the solution.
Maven shade plugin allows you to force append files that are identically named...
So what the maven-shade-plugin in the pom.xml lags is:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/javax.ws.rs.ext.Providers</resource>
</transformer>
https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer