[!CAUTION] This plugin is deprecated! Use this plugin instead!
Neotest adapter for Java using JUnit. Compatible with Gradle and Maven projects.
Requires nvim-treesitter and the parser for Java.
require("neotest").setup({
adapters = {
require("neotest-java")
}
})
By default, the plugin determines whether you are in a Gradle or Maven project, and runs the tests with the appropriate tool. You can customise which runner to use with the following settings:
require("neotest").setup({
adapters = {
require("neotest-java")({
-- function to determine which runner to use based on project path
determine_runner = function(project_root_path)
-- return should be "maven" or "gradle"
return "gradle"
end,
-- override the builtin runner discovery behaviour to always use given
-- tool. Default is "nil", so no override
force_runner = nil,
-- if the automatic runner discovery can't uniquely determine whether
-- to use Gradle or Maven, fallback to using this runner. Default is
-- "gradle"
fallback_runner = "gradle"
})
}
})