---
title: "Run Configurations and Maven Tasks in Neovim"
canonical: "https://mnafshin.info/devtools/09-run-configurations-and-maven-tasks/"
author: "Afshin Amini"
date: 2026-11-29
---
# Run Configurations and Maven Tasks in Neovim

A run configuration is a saved way to start an application: which main class, which program arguments, which JVM options. IDEs keep them so you don't retype `--server.port=8081` every morning. In Neovim, nvim-dap reads run configurations from a `launch.json` file, and overseer.nvim runs build commands, such as Maven goals, that you save in a `tasks.json` file. Both use the file formats VS Code made common.

## Configurations jdtls finds by itself

Part 7 started the app with `<leader>dc` and picked "Launch module-09-catalog: ...ShopApp" from a list. jdtls creates that entry for every class with a `main` method. It runs with no arguments and default JVM options.

For a one-off change, LazyVim maps `<leader>da`, "run with args", which asks for program arguments before it starts. That is fine once; for anything you repeat, save a configuration.

## Save a configuration in launch.json

Create `.vscode/launch.json` in the root of the repository. This one starts the catalog app on port 8081 and records a Java Flight Recorder file, which Part 10 uses:

```json
{
  "type": "java",
  "name": "Shop catalog on 8081 with JFR",
  "request": "launch",
  "projectName": "module-09-catalog",
  "mainClass": "info.mnafshin.springuniverse.shop.ShopApp",
  "args": "--server.port=8081",
  "vmArgs": "-XX:StartFlightRecording=filename=/tmp/shop.jfr,dumponexit=true"
}
```

[nvim-spring-ide: extras/vscode/launch.json](https://github.com/mnafshin/nvim-spring-ide/blob/main/extras/vscode/launch.json)

The fields come from the Java debug adapter. `projectName` is the Maven module, `mainClass` the class to run, `args` the program arguments and `vmArgs` the JVM options.

Press `<leader>dc` again. nvim-dap reads the file and adds "Shop catalog on 8081 with JFR" to the list, next to the configurations jdtls found. Choose it and Spring Boot starts on port 8081 with the recording running.

Commit the file if your team shares configurations, or add `.vscode/` to `.gitignore` if they are personal.

## Save build commands as tasks

Run configurations start your app. Build tools need a different kind of saved command: "run the tests of this module", "show the dependency tree". overseer.nvim is a task runner for Neovim, and LazyVim ships it as the `editor.overseer` extra. Enable it in `:LazyExtras`.

overseer reads tasks from `.vscode/tasks.json`. Two Maven tasks for module 9 look like this:

```json
{ "label": "catalog: test", "type": "shell",
  "command": "./mvnw -pl module-09-catalog test" },
{ "label": "catalog: dependency tree", "type": "shell",
  "command": "./mvnw -pl module-09-catalog dependency:tree" }
```

[nvim-spring-ide: extras/vscode/tasks.json](https://github.com/mnafshin/nvim-spring-ide/blob/main/extras/vscode/tasks.json)

`-pl` selects one module of the multi-module build, and `./mvnw` is the Maven Wrapper, so no Maven install is needed.

## Run a task

Press `<leader>oo`. A picker lists both tasks by label. Choose "catalog: dependency tree". The task starts in the background, and `<leader>ow` opens the task list with its status. When Maven finishes, the status turns to SUCCESS; open the task to read its output, here the module's dependency tree. LazyVim also maps `<leader>ot` for actions on a task, such as restarting it.

Keep Maven's output on for tasks you read. With `-q`, Maven prints almost nothing, and the dependency tree comes out empty.

## What jdtls does with Maven

jdtls reads `pom.xml` when it imports the project, so dependencies, source folders and the Java version come from Maven. After you edit the POM, run `:JdtUpdateConfig`. That is the whole Maven integration inside the language server. There is no tool window with lifecycle phases or a clickable dependency tree like IntelliJ IDEA's Maven tool window; the `dependency:tree` task is the text version.

jdtls also imports Gradle projects, and overseer can run `./gradlew` tasks the same way. The companion code uses Maven, so we tested only the Maven path; check the jdtls documentation before relying on Gradle details.

## Compared with IntelliJ IDEA

IntelliJ edits run configurations in a dialog and lists Maven goals in a tool window. Here both are small JSON files you edit by hand, which is less discoverable but easy to share in Git and to copy between projects. The VS Code format also means a teammate using VS Code can use the same files.

## Recap

- jdtls creates a launch configuration for each main class; `<leader>da` adds one-off arguments.
- Save repeatable configurations in `.vscode/launch.json` with `mainClass`, `projectName`, `args` and `vmArgs`; nvim-dap lists them under `<leader>dc`.
- Enable the `editor.overseer` extra and save Maven commands in `.vscode/tasks.json`.
- `<leader>oo` runs a task, `<leader>ow` shows the task list and output.
- Run `:JdtUpdateConfig` after editing `pom.xml`; there is no Maven tool window, only tasks.

**Series: Neovim as a Java IDE.** Previous: [Running Java tests in Neovim](/devtools/08-running-java-tests/) · Next: [Java Flight Recorder from Neovim](/devtools/10-java-flight-recorder/)

## Sources

Official documentation and well-known tutorials read while writing this article. The wording here is our own.

- [nvim-dap: launch.json support (dap-launch.json)](https://github.com/mfussenegger/nvim-dap/blob/master/doc/dap.txt)
- [vscode-java-debug: launch configuration options](https://github.com/microsoft/vscode-java-debug#options)
- [overseer.nvim README](https://github.com/stevearc/overseer.nvim)
- [LazyVim: editor.overseer extra](https://www.lazyvim.org/extras/editor/overseer)
- [Maven: guide to working with multiple modules](https://maven.apache.org/guides/mini/guide-multiple-modules.html)
- [IntelliJ IDEA: Run/debug configurations](https://www.jetbrains.com/help/idea/run-debug-configuration.html)
- [Lorenzo Bettini: Neovim and Java with LazyVim, part 4: Running programs](https://www.lorenzobettini.it/2025/03/neovim-and-java-with-lazyvim-part-4-running-programs/)
- [Lorenzo Bettini: Neovim and Java with LazyVim, part 3: Dependencies and Maven](https://www.lorenzobettini.it/2025/01/neovim-and-java-with-lazyvim-part-3-dependencies-and-maven/)
- [Trinity Logic: A Terminal-First Java and Maven Setup — Neovim, jdtls and the Build Loop](https://www.trinitylogic.co.uk/blog/terminal-first-java-maven-neovim-jdtls/)
