Skip to content

Running Imposter as a JAR on the JVM

There are many ways to run Imposter. This section describes how to use a JAR file on the JVM.

Other ways to run Imposter

Standalone mock server

Embedded in tests

JAR File Features

Note: if you want to embed Imposter in your JUnit tests, see JVM bindings instead.

Run

Prerequisites

You must have a JVM installed. Java 11 and 15 have been confirmed as compatible. Others may also be, but are not currently tested.

Note: As of version 3, Imposter no longer supports Java 8. If Java 8 support is required, Imposter 2.x is still available, but may no longer be maintained.

Run the JAR as follows:

java -jar distro/all/build/libs/imposter-all.jar \
    --plugin <plugin name> \
    --configDir <config dir> \
    [args]

...ensuring that you choose the right plugin you wish to use, for example:

java -jar distro/all/build/libs/imposter-all.jar \
    --plugin rest \
    --configDir /path/to/config \
    [args]

Example

$ java -jar ./imposter-all.jar --plugin rest --configDir ./example-api

Starting server on port 8080...
Parsing configuration file: someapi-config.yaml
...
Mock server is up and running

Usage

See full usage instructions.


What's next