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, 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. creates that entry for every class with a main method. It runs with no arguments and default JVM options.
For a one-off change, 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 file, which Part 10 uses:
{
"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
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:
{ "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
-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>daadds one-off arguments. - Save repeatable configurations in
.vscode/launch.jsonwithmainClass,projectName,argsandvmArgs; nvim-dap lists them under<leader>dc. - Enable the
editor.overseerextra and save Maven commands in.vscode/tasks.json. <leader>ooruns a task,<leader>owshows the task list and output.- Run
:JdtUpdateConfigafter editingpom.xml; there is no Maven tool window, only tasks.
Series: Neovim as a Java IDE. Previous: Running Java tests in Neovim · Next: Java Flight Recorder from Neovim
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)
- vscode-java-debug: launch configuration options
- overseer.nvim README
- LazyVim: editor.overseer extra
- Maven: guide to working with multiple modules
- IntelliJ IDEA: Run/debug configurations
- Lorenzo Bettini: Neovim and Java with LazyVim, part 4: Running programs
- Lorenzo Bettini: 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
Comments