{"id":34862667,"url":"https://github.com/rcasia/neotest-java","last_synced_at":"2026-04-19T12:03:04.852Z","repository":{"id":169803846,"uuid":"569040046","full_name":"rcasia/neotest-java","owner":"rcasia","description":"Neotest adapter for Java.","archived":false,"fork":false,"pushed_at":"2026-03-29T15:43:13.000Z","size":1068,"stargazers_count":67,"open_issues_count":12,"forks_count":40,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-03-29T18:17:00.347Z","etag":null,"topics":["java","junit","lua","neotest","neovim"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcasia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-22T00:20:21.000Z","updated_at":"2026-03-28T14:56:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"e08f2d3c-2c63-429f-adb3-e84d9a82b23a","html_url":"https://github.com/rcasia/neotest-java","commit_stats":null,"previous_names":["rcasia/neotest-java"],"tags_count":154,"template":false,"template_full_name":null,"purl":"pkg:github/rcasia/neotest-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasia%2Fneotest-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasia%2Fneotest-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasia%2Fneotest-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasia%2Fneotest-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcasia","download_url":"https://codeload.github.com/rcasia/neotest-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasia%2Fneotest-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","junit","lua","neotest","neovim"],"created_at":"2025-12-25T21:31:09.883Z","updated_at":"2026-04-19T12:03:04.840Z","avatar_url":"https://github.com/rcasia.png","language":"Lua","readme":"\n\u003csection align=\"center\"\u003e\n\n  \u003ch1\u003eneotest-java\u003c/h1\u003e\n  \u003cp\u003e \u003ca href=\"https://github.com/rcarriga/neotest\"\u003eNeotest\u003c/a\u003e adapter for Java, using \u003ca href=\"https://github.com/junit-team/junit5\"\u003eJUnit\u003c/a\u003e.\u003c/p\u003e\n\n  \u003ca href=\"https://github.com/rcasia/neotest-java/actions/workflows/ci-pipeline.yml\"\u003e\n    \u003cimg src=\"https://github.com/rcasia/neotest-java/actions/workflows/ci-pipeline.yml/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://luarocks.org/modules/rcasia/neotest-java\"\u003e\n    \u003cimg alt=\"LuaRocks\" src=\"https://img.shields.io/luarocks/v/rcasia/neotest-java\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://github.com/rcasia/neotest-java\"\u003e\n    \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/rcasia/neotest-java\"\u003e\n  \u003c/a\u003e\n\u003c/section\u003e\n\n![image](https://github.com/user-attachments/assets/d1d77980-faab-4110-9b7c-ae6911a3d42c)\n\n## ⭐ Features\n\n- ✅ **Maven \u0026 Gradle** - Full support for both build systems (Groovy \u0026 Kotlin DSL)\n- ✅ **Multi-module projects** - Automatic detection and per-module test execution\n- ✅ **JUnit 5 (Jupiter)** - Support for `@Test`, `@ParameterizedTest`, `@TestFactory`, nested tests\n- ✅ **JUnit Platform 1.10.x \u0026 6.x** - Compatible with both legacy and latest versions\n- ✅ **Spring Framework** - Auto-loads `application.yml`, `application-test.yml`, and `.properties` files\n- ✅ **Debugging with nvim-dap** - Full integration with breakpoints, JDWP, and DAP REPL output\n- ✅ **Incremental compilation** - Smart compilation of only changed files via nvim-jdtls\n- ✅ **Automatic classpath management** - Retrieves runtime and test classpaths from LSP\n- ✅ **JUnit JAR management** - Automatic installation, version detection, and upgrade prompts\n- ✅ **Health check** - Comprehensive diagnostics with `:checkhealth neotest-java`\n\n\u003e Check [ROADMAP.md](./ROADMAP.md) to see what's coming!\n\n## 📦 Installation\n\n### Prerequisites\n\n- **Neovim 0.10.4+**\n- **nvim-treesitter** with Java parser: `:TSInstall java`\n- **A JDTLS-based Java LSP** — either [nvim-jdtls](https://github.com/mfussenegger/nvim-jdtls) or [nvim-java](https://github.com/nvim-java/nvim-java) (both are compatible)\n- **nvim-dap** - For debugging support (optional)\n\n### Setup with [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n#### Using nvim-jdtls\n\n```lua\nreturn {\n  {\n    \"rcasia/neotest-java\",\n    ft = \"java\",\n    dependencies = {\n      \"mfussenegger/nvim-jdtls\",\n      \"mfussenegger/nvim-dap\", -- for debugging (optional)\n      \"rcarriga/nvim-dap-ui\", -- recommended\n      \"theHamsta/nvim-dap-virtual-text\", -- recommended\n    },\n  },\n  {\n    \"nvim-neotest/neotest\",\n    dependencies = {\n      \"nvim-neotest/nvim-nio\",\n      \"nvim-lua/plenary.nvim\",\n      \"nvim-treesitter/nvim-treesitter\",\n    },\n    config = function()\n      require(\"neotest\").setup({\n        adapters = {\n          require(\"neotest-java\")({\n            -- Optional configuration here\n          }),\n        },\n      })\n    end,\n  },\n}\n```\n\n#### Using nvim-java\n\n[nvim-java](https://github.com/nvim-java/nvim-java) is fully compatible — neotest-java communicates with the LSP through the standard `vim.lsp.Client` API and does not depend directly on nvim-jdtls.\n\n```lua\nreturn {\n  {\n    \"rcasia/neotest-java\",\n    ft = \"java\",\n    dependencies = {\n      \"mfussenegger/nvim-dap\", -- for debugging (optional)\n    },\n  },\n  -- nvim-java handles JDTLS setup separately\n  { \"nvim-java/nvim-java\" },\n  {\n    \"nvim-neotest/neotest\",\n    dependencies = {\n      \"nvim-neotest/nvim-nio\",\n      \"nvim-lua/plenary.nvim\",\n      \"nvim-treesitter/nvim-treesitter\",\n    },\n    config = function()\n      require(\"neotest\").setup({\n        adapters = {\n          require(\"neotest-java\")({\n            -- Optional configuration here\n          }),\n        },\n      })\n    end,\n  },\n}\n```\n\n### JUnit JAR Installation\n\nAfter setting up the plugin, run:\n\n```vim\n:NeotestJava setup\n```\n\nThis will automatically download and verify the JUnit Platform Console Standalone JAR from [Maven Central](https://mvnrepository.com/artifact/org.junit.platform/junit-platform-console-standalone) with SHA-256 checksum verification.\n\n\u003e [!TIP]\n\u003e The plugin will detect if you have an older JUnit version installed and prompt you to upgrade to the latest version.\n\n## ⚙️ Configuration\n\nAll configuration options are optional. Pass them to `require(\"neotest-java\")({})`:\n\n```lua\nrequire(\"neotest\").setup({\n  adapters = {\n    require(\"neotest-java\")({\n      junit_jar = nil, -- default: auto-detected\n      jvm_args = { \"-Xmx512m\" }, -- custom JVM arguments\n      incremental_build = true, -- recompile only changed files\n      disable_update_notifications = false, -- show JUnit update prompts\n      test_classname_patterns = { \"^.*Tests?$\", \"^.*IT$\", \"^.*Spec$\" },\n    }),\n  },\n})\n```\n\n### Options\n\n| Option                        | Type       | Default                                                    | Description                                                                 |\n|-------------------------------|------------|------------------------------------------------------------|-----------------------------------------------------------------------------|\n| `junit_jar`                   | `string?`  | `stdpath(\"data\")/neotest-java/junit-*.jar`                | Path to JUnit Platform Console Standalone JAR                               |\n| `jvm_args`                    | `string[]` | `{}`                                                       | Additional JVM arguments for test execution                                 |\n| `incremental_build`           | `boolean`  | `true`                                                     | Enable incremental compilation (recompile only changed files)               |\n| `disable_update_notifications`| `boolean`  | `false`                                                    | Disable notifications about available JUnit updates                         |\n| `test_classname_patterns`     | `string[]` | `{\"^.*Tests?$\", \"^.*IT$\", \"^.*Spec$\"}`                    | Regex patterns for test class names (classes must match at least one pattern)|\n\n## ⚠️ Troubleshooting\n\n### Spring Tests Failing with \"parameter name information not available\"\n\nIf you're running Spring tests that use reflection (e.g., `@MockBean`, `@WebMvcTest`) and encounter errors like:\n\n```\njava.lang.IllegalArgumentException: Name for argument of type [int] not specified,\nand parameter name information not available via reflection.\nEnsure that the compiler uses the '-parameters' flag.\n```\n\n**Solution:** Configure the JDTLS compiler to preserve parameter names in bytecode by adding the following to your project's `.settings/org.eclipse.jdt.core.prefs` file:\n\n```properties\norg.eclipse.jdt.core.compiler.codegen.methodParameters=generate\n```\n\nIf the `.settings` directory doesn't exist, create it in your project root:\n\n```bash\nmkdir -p .settings\necho \"org.eclipse.jdt.core.compiler.codegen.methodParameters=generate\" \u003e .settings/org.eclipse.jdt.core.prefs\n```\n\nAfter adding this setting, restart your LSP server (`:LspRestart`) and run your tests again.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to:\n\n- 🐛 Report bugs and issues\n- 💡 Suggest new features or improvements\n- 🔧 Submit pull requests\n\nSee [CONTRIBUTING.md](https://github.com/rcasia/neotest-java/blob/main/CONTRIBUTING.md) for guidelines.\n\n### Running Tests\n\nThe project includes both unit tests and end-to-end (E2E) tests:\n\n```bash\n# Run unit tests\nmake test\n\n# Run E2E tests (requires Java and JAVA_HOME)\nmake test-e2e\n\n# Run all tests\nmake test \u0026\u0026 make test-e2e\n```\n\n**E2E Test Requirements:**\n- Java JDK (11 or higher)\n- `JAVA_HOME` environment variable set\n- Maven wrapper is included in the test fixture\n\nSee [tests/e2e/README.md](tests/e2e/README.md) for detailed E2E test documentation.\n\n## ✨ Acknowledgements\n\nThanks to all contributors who have helped improve this project!\n\n[![Contributors](https://contrib.rocks/image?repo=rcasia/neotest-java)](https://github.com/rcasia/neotest-java/graphs/contributors)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcasia%2Fneotest-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcasia%2Fneotest-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcasia%2Fneotest-java/lists"}