wiremock / gradle-wiremock-extension-plugins

Gradle plugins that bundles common packaging and release logic for WireMock extensions
Apache License 2.0
5 stars 3 forks source link

What does it mean to be a standalone extension? #11

Closed kyle-winkelman closed 8 months ago

kyle-winkelman commented 10 months ago

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, using Json.read(json, TypeReference<List<Example>> {} ()) will cause an issue because TypeReference in WireMock will be relocated to wiremock.org.fasterxml.jackson but your standalone extension will still be using org.fasterxml.jackson.

References

wiremock-standalone relocates to copy make standalone extension jar smaller by declaring these shadow

oleg-nenashev commented 10 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

tomakehurst commented 9 months ago

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).