# WireMock

IntelliJ IDEA provides support for [WireMock](https://www.wiremock.io/what-is-wiremock), a tool for stubbing HTTP services. Stubbing involves creating stubs or set responses to API calls that mimic real API behavior without the need for actual server communication.

Procedure: Install the WireMock plugin

This functionality relies on the [WireMock](https://plugins.jetbrains.com/plugin/23695-wiremock)  plugin, which   you need to install and enable.

> **Note:**
> The WireMock plugin is not available in IntelliJ IDEA without the Ultimate subscription.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Marketplace tab, find the WireMock plugin, and click Install (restart the IDE if prompted).

## Create WireMock stubs

Procedure: Create basic WireMock stub from scratch

If a JSON file is placed in the mappings folder or contains the `"mappings"` key, IntelliJ IDEA recognizes it as a WireMock stub file and provides appropriate coding assistance.

1. In the Project tool window, right-click a folder (or press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Ctrl+N` (Visual Studio), `⌘ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS))) and select `New | File`.

2. In the New File dialog that opens, enter a name of the file. For example, you can enter `mappings/my-stub.json`, and IntelliJ IDEA will create the mappings folder and place the new file within it.

3. Start typing a key to get suggestions for applicable keys and their quick documentation.

![Wiremock Coding Assistance](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_coding_assistance.png)

Procedure: Create WireMock stubs from Endpoints tool window

1. Open the Endpoints tool window (`View | Tool Windows | Endpoints`).

2. Right-click an endpoint and select Generate WireMock Stubs.

![Creating WireMock stub from Endpoints](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_stub_from_endpoints.png)

The new stub file is saved as a [scratch](scratches.html) under `Scratches and Consoles | WireMock Stubs`.

Procedure: Create WireMock stubs from OpenAPI specification

1. Open an OpenAPI specification file.

2. Click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.gutter.run.svg) and select Generate WireMock Stubs.

![Creating WireMock stub from Endpoints](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_stub_from_openapi_specification.png)

The new stub file is saved as a [scratch](scratches.html) under `Scratches and Consoles | WireMock Stubs`.

Procedure: Run WireMock server

1. Open your stub file.

2. Click ![Run WireMock](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.webReferences.server.svg) in the upper-right part of the editor.

![Run WireMock](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_start_from_stub.png)

This will start the WireMock server, and you can see it running in the Services tool window (`View | Tool Windows | Services` or press `Alt+8` (Windows), `⌘ 8` (macOS), `⌘ 8` (IntelliJ IDEA Classic (macOS)), `⌘ 8` (macOS System Shortcuts), `Alt+8` (XWin), `Alt+8` (GNOME), `Alt+8` (KDE), `Alt+8` (Emacs), `Alt+8` (Sublime Text), `⌘ 8` (Sublime Text (macOS)), `Alt+8` (NetBeans), `Alt+8` (Visual Studio), `Alt+8` (Visual Studio (macOS)), `Alt+8` (Eclipse), `⌘ 8` (Eclipse (macOS))).

![WireMock in Services](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_running_in_services_tool_window.png)

To customize how IntelliJ IDEA starts the WireMock server, you can [modify
the WireMock run configuration](#wiremock-run-configuration) or create a new one.

Procedure: Send HTTP requests

Use the IntelliJ IDEA [HTTP Client](http-client-in-product-code-editor.html) to send HTTP requests to the WireMock server and preview responses.

1. [Run your WireMock server.](#run-wiremock-server)

2. Open your stub JSON file.

3. Place the caret at your endpoint URL, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) (Show Context Actions), and select Generate request in HTTP Client.

You can view the stub response in the Services tool window.

![HTTP request to WireMock stub](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_send_http_request.gif)

Procedure: Enable support for Handlebars templates

IntelliJ IDEA provides coding assistance for templating language used in WireMock response templates. To use this feature, you need the [Handlebars/Mustache](https://plugins.jetbrains.com/plugin/6884-handlebars-mustache) plugin to be installed and enabled.

1. Open your stub JSON file.

2. In the upper-right part of the editor, click ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/handlebarsJson.svg) (Use Handlebars Templates). If the [Handlebars/Mustache](https://plugins.jetbrains.com/plugin/6884-handlebars-mustache) plugin is not installed, the action will install it.

This will make IntelliJ IDEA treat JSON files placed in the `__files` directory as response templates and provide appropriate Handlebars coding assistance including completion for [Handlebars helpers](https://wiremock.org/docs/response-templating/#handlebars-helpers).

![Enable support for Handlebars templates](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_handlebars.png)

## WireMock run configuration

> **TL;DR**
> Create: `Run | Edit Configurations |` ![Add New Configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) `| WireMock`

IntelliJ IDEA comes with a dedicated WireMock run configuration, which allows you to customize how to start the WireMock server.

![WireMock run configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/wiremock_run_configuration.png)

### Main parameters

Name
: Specify a name for the run configuration.

Stubs file
: Location of the JSON file with WireMock stubs to run.

Server port
: HTTP port number for the WireMock server. Enter `0` to dynamically determine a port.

### Modify options

Verbose output
: Turn on verbose logging to stdout (equivalent for the `--verbose` option).

Enable global Handlebars templating
: Render all response definitions using Handlebars templates by passing the `--global-response-templating` [Wiremock command line option](https://wiremock.org/docs/standalone/java-jar/#command-line-options).

JRE
: Select a JRE if you wish to run WireMock in a different runtime environment than JBR.

#### Logs

Specify which log files generated while running the application should be displayed in the console on the dedicated tabs of the [Run](run-tool-window.html) tool window.

#### Before launch

Select tasks to be performed before starting the selected run/debug configuration.

