https://github.com/rcasia/neotest-java
Neotest adapter for Java.
https://github.com/rcasia/neotest-java
java junit lua neotest neovim
Last synced: about 1 month ago
JSON representation
Neotest adapter for Java.
- Host: GitHub
- URL: https://github.com/rcasia/neotest-java
- Owner: rcasia
- License: mit
- Created: 2022-11-22T00:20:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-10T19:22:03.000Z (about 1 month ago)
- Last Synced: 2026-01-12T18:34:37.681Z (about 1 month ago)
- Topics: java, junit, lua, neotest, neovim
- Language: Lua
- Homepage:
- Size: 858 KB
- Stars: 66
- Watchers: 3
- Forks: 38
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
neotest-java
Neotest adapter for Java, using JUnit.

## ⭐ Features
- ✅ Maven and Gradle projects
- ✅ Multimodule projects
- ✅ Integrated with [`nvim-dap`](https://github.com/mfussenegger/nvim-dap) for test debugging.
> Check [ROADMAP.md](./ROADMAP.md) to see what's coming!
## :wrench: Installation
##### Install in 3 steps :athletic_shoe:
1. Make sure you have installed nvim-treesitter parsers. Use `:TSInstall java`
2. Add neotest-java to your config:
lazy.nvim plugin manager example
```lua
return {
{
"rcasia/neotest-java",
ft = "java",
dependencies = {
"mfussenegger/nvim-jdtls",
"mfussenegger/nvim-dap", -- for the debugger
"rcarriga/nvim-dap-ui", -- recommended
"theHamsta/nvim-dap-virtual-text", -- recommended
},
},
{
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-java")({
-- config here
}),
},
})
end,
}
}
```
3. Run `:NeotestJava setup`
> [!NOTE]
> It will download the JUnit standalone jar from
>
>
> **Autoinstall requires Neovim v0.12.0+ (nightly)** - The `vim.fn.sha256()` function used for checksum verification requires this version. For older versions, manually download the JAR file.
## :gear: Configuration
| Option | Type | Default | Description |
|---------------------|-------------|-------------------------------------------------------------------------------------------------|---------------------------------------------------------|
| `junit_jar` | `string?` | `stdpath("data") .. /nvim/neotest-java/junit-platform-console-standalone-[version].jar` | Path to the JUnit Platform Console standalone JAR. |
| `jvm_args` | `string[]` | `{}` | Additional JVM arguments passed when running tests. |
| `incremental_build` | `boolean` | `true` | Enable incremental compilation before running tests. |
| `test_classname_patterns` | `string[]` | `{"^.*Tests?$", "^.*IT$", "^.*Spec$"}` | Regular expressions used to include only classes whose names match these patterns. Classes not matching any pattern will be ignored. |
## :octocat: Contributing
Feel free to contribute to this project by creating issues for bug
reports, feature requests, or suggestions.
You can also submit pull requests for any enhancements, bug fixes, or new features.
Your contributions are greatly appreciated. See [CONTRIBUTING.md](https://github.com/rcasia/neotest-java/blob/main/CONTRIBUTING.md)
## :sparkles: Acknowledgements
[](https://github.com/rcasia/neotest-java/graphs/contributors)