Skip to content

[BUG] No way to set custom path for pom.xml ANT project #205

@NathanielRN

Description

@NathanielRN

NeoVim Version

❯ nvim --version
NVIM v0.11.2
Build type: Release
LuaJIT 2.1.1748459687
Run "nvim -V1 -v" for more info

Describe the bug

In #153 the source_dir option was removed. I believe this was a significant feature for my project set up because I use build.xml instead of pom.xml. I can run unit tests with <leader>tr with this config:

return {
  {
    "rcasia/neotest-java",
    ft = "java",
    dependencies = {
      "mfussenegger/nvim-jdtls",
      "mfussenegger/nvim-dap",
      "rcarriga/nvim-dap-ui",
      "theHamsta/nvim-dap-virtual-text",
    },
  },
  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-neotest/nvim-nio",
      "nvim-lua/plenary.nvim",
      "antoinemadec/FixCursorHold.nvim",
      "nvim-treesitter/nvim-treesitter",
    },
    opts = {
      adapters = {
        ["neotest-java"] = {
          root_dir = function()
            -- Force Neotest to recognize Ant by treating it like Maven
            local cwd = vim.fn.getcwd()
            if vim.fn.filereadable(cwd .. "/build.xml") == 1 then
              return cwd
            end
            return require("jdtls.setup").find_root({ "pom.xml", "build.gradle", ".git" }) or cwd
          end,
          ignore_wrapper = true,
          force_test_class = true,
          incremental_build = true,
          extra_args = { "-Dtest=true -Ddomain=test -Djunit.jupiter.execution.parallel.enabled=false" },
        },
      },
    },
  },
}

but I cannot run them in the summary window by clicking on them with r or see their status update because the summary window gives me the error unknown project type: unknown. I got this error when running the tests and before I added the root_dir override in nvim-neotest/neotest, but I can't do the same for rcasia/neotst-java which means I can't see the status of my tests execution.

Expected behavior

Can we add the source_dir feature back or otherwise help the summary page find the project so it can update the status of the run tests?
A clear and concise description of what you expected to happen.

Logs

  1. Wipe the neotest.log file in stdpath("log") or stdpath("data").
  2. Wipe the neotest-java.log file in stdpath("log") or stdpath("data").
  3. Set log_level = vim.log.levels.DEBUG in your neotest setup config.
  4. Reproduce the issue.
  5. Provide the new logs.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions