1

Pretty sure this is a duplicate question, but couldn't find the answer I'm looking for.

I'm trying to run WireMock standalone with WebHook extensions. Both come packaged as JAR files. First one, wiremock-jre8-standalone-2.28.1.jar is a runnable fat jar and it works like a charm when I type:

java -jar wiremock-jre8-standalone-2.28.1.jar

WebHook extensions (wiremock-webhooks-extension-1.0.0.jar) is a normal JAR that contains a class org.wiremock.webhooks.Webhooks. I'm trying to run WireMock this way:

java -cp wiremock-webhooks-extension-1.0.0.jar                 \
     -jar wiremock-jre8-standalone-2.28.1.jar --extensions org.wiremock.webhooks.Webhooks

And I get the following error:

Exception in thread "main" java.lang.ClassNotFoundException: org.wiremock.webhooks.Webhooks

What I get from this question is that if -jar is specified on the command line, -cp is ignored and MANIFEST is used instead. So I've tried

java -cp wiremock-webhooks-extension-1.0.0.jar:wiremock-jre8-standalone-2.28.1.jar  \
    com.github.tomakehurst.wiremock.standalone.WireMockServerRunner                 \
    --extensions org.wiremock.webhooks.Webhooks

but got:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

Of course, HttpClient is part of WireMock dependencies. WireMock standalone JAR manifest is as follows:

Manifest-Version: 1.0
Main-Class: com.github.tomakehurst.wiremock.standalone.WireMockServerR
 unner

I want to run the fat JAR, adding an external JAR to the classpath, but with no original dependencies ignored. How can I achieve this?

DiegoAlfonso
  • 237
  • 5
  • 15

0 Answers0