Closed kyle-winkelman closed 8 months ago
It's a good question for @tomakehurst. Personally I would expect that indeed the standalone shaded jar properly handles relocation of upstream dependencies ootb
I wouldn't recommend classifying an extension as standalone or otherwise, but instead having it build two JARs - one for use with WireMock core standalone, one with the standard build.
The gRPC is a good example of this (although it's not yet been upgraded to use Oleg's Gradle plugin, which simplifies the process of building in this way).
Proposal
Should a standalone extension be:
The reason I am asking is because depending on what is envisioned I would expect the shadowjar to be created differently.
If it is to be compatible with wiremock-standalone, it should
relocate
the same packages as wiremock-standalone does.If it is to be used alongside wiremock-standalone, it should define the wiremock dependencies as
shadow
to make the jar a lot smaller.Reproduction steps
Create a standalone extension that uses a transitive dependency of WireMock like
org.fasterxml.jackson
then put wiremock-standalone on the classpath before your extension. For example, usingJson.read(json, TypeReference<List<Example>> {} ())
will cause an issue because TypeReference in WireMock will be relocated towiremock.org.fasterxml.jackson
but your standalone extension will still be usingorg.fasterxml.jackson
.References
wiremock-standalone relocates to copy make standalone extension jar smaller by declaring these shadow