Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rcasia/neotest-java

Repository files navigation

neotest-java

Neotest adapter for Java, using JUnit.

LuaRocks GitHub Repo stars

image

⭐ Features

  • ✅ Maven and Gradle projects
  • ✅ Multimodule projects
  • ✅ Integrated with nvim-dap for test debugging.

Check ROADMAP.md to see what's coming!

🔧 Installation

Install in 3 steps 👟
  1. Make sure you have installed nvim-treesitter parsers. Use :TSInstall java
  2. Add neotest-java to your config:
lazy.nvim plugin manager example
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,
}
}
  1. Run :NeotestJava setup

Note

It will download the JUnit standalone jar from https://mvnrepository.com/artifact/org.junit.platform/junit-platform-console-standalone

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.

⚙️ 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

✨ Acknowledgements

Contributors

About

Neotest adapter for Java.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 22

Languages