Skip to content

bug: Unable to install with nvchad. Cannot find package "lombok-nightly" #349

Closed as not planned

Description

@fayimora

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.4

Operating system/version

MacOS 15.0.1

Describe the bug

Not sure if this is a bug or just missing something in configuration. I am using NvChad as my base setup. I followed the instructions and always end up with this error:

   Error  01:49:24 notify.error Java Failed to setup nvim-java ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: Cannot find package "lombok-nightly"

Essentially, jdtls does not get installed but it seems that's because lombok-nightly fails for reasons I cannot figure out.

Steps To Reproduce

Add the plugin to plugins.lua file

{'nvim-java/nvim-java'}

At the top of the lsp config, add:

require("java").setup()

add jdtls to the ensure_installed for mason. (tried without doing this too)

Close and open java project in vim.

Image

Expected Behavior

Everything downloaded and installed.

Activity

  1. YSNBx commented on Feb 10, 2025

    @YSNBx

    Any workarounds? Getting the same issue and I haven't managed to circumvent this issue.

  2. rssnk commented on Feb 10, 2025

    @rssnk

    mason tells you that it failed to download jdtls tarball from eclipse of. downloads portal. maybe it causes problems with lombok

    i have the same issue with jdtls

  3. fayimora commented on Feb 10, 2025

    @fayimora
    Author

    mason tells you that it failed to download jdtls tarball from eclipse of. downloads portal. maybe it causes problems with lombok

    i have the same issue with jdtls

    Yeah I'm able to download and setup jdtls without nvim-java which led me to believe something else is going on. I haven't looked at the plugin's code yet.

    How i tested jdtls on it's own:
    Add jdtls to the ensure_installed for mason. and then set up the lsp config:

    lspconfig["jdtls"].setup {
        on_attach = on_attach,
        capabilities = capabilities,
      }

    That works fine but when i remove it and allow nvim-java to set everything up, I get the above errors.

  4. SlugBoot commented on Feb 15, 2025

    @SlugBoot

    Current workaround I've found from the troubleshooting page is to remove the config = function() from mason.nvim configuration and using opts instead

  5. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    @s1n7ax any idea what could be going wrong here?

  6. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    You can find the solution here

    https://github.com/nvim-java/nvim-java/wiki/Troubleshooting#no_entry-mason-failed-to-install-jdtls---cannot-find-package-xxxxx

    My mason only used opts in the first place but I also tried setting it up with config function as described there but no luck, same issue 🤕

    My original conf :

      {
        "williamboman/mason.nvim",
        opts = overrides.mason,
        dependencies = {
          "WhoIsSethDaniel/mason-tool-installer.nvim",
        }
      },
    

    Then i tried this:

      {
        "williamboman/mason.nvim",
        opts = overrides.mason,
        dependencies = {
          "WhoIsSethDaniel/mason-tool-installer.nvim",
        },
        config = function(_, opts)
          local conf = vim.tbl_deep_extend("keep", opts, overrides.mason)
          require("mason").setup(conf)
        end,
      },
    
  7. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    What is overrides.mason? A function? What does it do?

  8. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    What is overrides.mason? A function? What does it do?

    it's just an object with configs for different plugins to keep the plugin file a bit cleaner:

    M.mason = {
      ensure_installed = {
        "astro-language-server",
        -- lua stuff
        "lua-language-server",
        "stylua",
    
        -- web dev stuff
        "css-lsp",
        "html-lsp",
        "typescript-language-server",
        "deno",
        "eslint_d",
        "prettier",
        -- "eslint",
        "tailwindcss-language-server",
    
        -- c/cpp stuff
        "clangd",
        "clang-format",
    
        -- other stuff
        "bash-language-server",
        "circleci-yaml-language-server",
        "dockerfile-language-server",
        "docker-compose-language-service",
        "gradle-language-server",
        "jsonnet-language-server",
        -- "jdtls",
        "helm-ls",
        "gopls",
        "rust-analyzer",
        "codelldb",
      },
    }
    
    

    I printed the config before and after:

    Image

  9. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    That's unusual. As a workaround, you can put the registry manually into mason config. Check following file to copy the mason opts.

    https://github.com/nvim-java/nvim-java/blob/main/lazy.lua

    Do you have the configuration on GitHub?

  10. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    If you are using nvchad, their implementation might be the problem.

    image

    I cannot check this now but I'm guessing if a function is passed to opts then previous opts that comes as the second parameter should be merged. In not 100% though. Something like below

    opts=function(_, prev_opts)
    return merge(prev_opts, custom_opts)
    end

  11. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    According to the lazy.nvim documentation, if opts is a function, then the return table will replace parent table.

    image

    Please create an issue in nvchad to get it fixed

  12. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    If you are using nvchad, their implementation might be the problem.

    Interesting. I have Mason defined in my own init lua which i believe overrides what they do. I'll check that.

    on another note, writing the registry manually seems to have solved the installation issue. Installation completed but i'm not getting anything(like autocomplete) when i open a java file. Also, everytime i open a new file, mason starts trying to install spring-boot-tools and update java-test

    see the changes here alongside the vim config fayimora/dotfiles@ebc2141

  13. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    Well, you should let it install. Nvim-java will not proceed unless there are all the required packages are installe. Nvchad replaced nvim java config and you override nvchad config. I'm closing the ticket since this looks like an issue in the distribution

  14. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    Well, you should let it install. Nvim-java will not proceed unless there are all the required packages are installe. Nvchad replaced nvim java config and you override nvchad config. I'm closing the ticket since this looks like an issue in the distribution

    I did let it finish but getting nothing in java files. Somehow nvim-java is not starting jdtls cause manually installing jdtls lsp give me autocomplete at least.

  15. s1n7ax commented on Feb 15, 2025

    @s1n7ax
    Member

    Nvim java does not start the language server. That's for you to do. What this plugin does is setting up packages for you to start jdtls using lspconfig. That's clearly mentioned in the readme

  16. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    Nvim java does not start the language server.

    Ah! Should probably put this in the readme then. Readme says:

    Uses nvim-lspconfig to setup jdtls

    which i assumed meant it did all the ls stuff too.

    I just added it back to my mason ensure_installed and started it. Everything seems to work fine now! Wow that was quite the ride. Thanks for the assist, much appreciated

  17. fayimora commented on Feb 15, 2025

    @fayimora
    Author

    Ignore my previous comment about readme. i spent so much time trying to get this work i forgot the readme required you to start jdtls

  18. s1n7ax commented on Feb 16, 2025

    @s1n7ax
    Member

    Following fixes the mason registry issue. Please try updating nvim-java and see if everything works with manually adding the nvim-java mason registry
    #355

  19. s1n7ax commented on Feb 16, 2025

    @s1n7ax
    Member

    Following fixes the mason registry issue. Please try updating nvim-java and see if everything works with manually adding the nvim-java mason registry
    #355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions