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
- Using the command line client - see Imposter CLI
- As a Docker container - see Imposter Docker container
- As a Lambda function in AWS - see Imposter AWS Lambda
Embedded in tests
- Embedded within your Java/Kotlin/Scala/JVM unit tests - see JVM bindings
- Embedded within your JavaScript/Node.js unit tests - see JavaScript bindings
JAR File Features
- Start mocks
- Supports all plugins
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
- Learn how to use Imposter with the Configuration guide.