Skip to content

bug: nvim-java is conflicting with mason regarding jdtls, java-test, and spring-boot-tools #379

Closed as duplicate

Description

@4r73m190r0s

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)

0.11

Operating system/version

Windows 10

Describe the bug

I have opened an issue on mason repository, but it seems that this bug is related to nvim-java.

When I open Neovim, its always tries to downgrade JDTLS from latest version (1.46) to version 1.43.0.

Another issue is that every Neovim start, either tries to upgrade, or to downgrade java-test and spring-boot-tools. Versions it's switching between are java-test versions 0.40.1 <-> 0.43.0, and for spring-boot-tools 1.55.1 <-> 1.59.0.

Steps To Reproduce

  1. Install mason version 2.0
  2. Install latest nvim-java
  3. Enable jdtls
  4. Enter Neovim
  5. Exit Neovim
  6. Enter Neovim

Expected Behavior

Expected behavior is for nvim-java not try to overwrite mason's installations.

Activity

  1. PKBurov commented on May 13, 2025

    @PKBurov

    I got the same exact thing

  2. MinaJoh96 commented on May 14, 2025

    @MinaJoh96

    Same here

  3. panmini commented on May 15, 2025

    @panmini

    You might want to consider adding the nvim-java Mason registry to your mason.nvim configuration. This can help resolve issues where Mason attempts to install a newer or incompatible version of certain nvim-java packages.

    As described in the nvim-java troubleshooting guide, the default Mason registry may not include the required packages or might reference outdated paths.

    Here's an example configuration that prioritizes the nvim-java registry:

    {
      'mason-org/mason.nvim',
      opts = {
        registries = {
          'github:nvim-java/mason-registry',
          'github:mason-org/mason-registry',
        },
        ui = {
          icons = {
            package_installed = '✓',
            package_pending = '➜',
            package_uninstalled = '✗',
          },
        },
      },
    }

    This setup ensures that packages provided by nvim-java are correctly located and installed by Mason.
    I tried this solution and it worked successfully.
    Hopefully, it will be helpful for others too!

    Update:

    You can also use the following jdtls configuration to utilize a different version of the packages. However, the version recommended by nvim-java is likely the best option for compatibility and performance.

          require('java').setup {
            root_markers = {
              'settings.gradle',
              'settings.gradle.kts',
              'pom.xml',
              'build.gradle',
              'mvnw',
              'gradlew',
              'build.gradle',
              'build.gradle.kts',
              '.git',
            },
            jdtls = {
              -- version = 'v1.43.0',
              language_servers = {
                {
                  name = 'spring-boot-language-server',
                  command = { 'spring-boot-language-server', '--stdio' },
                  root_patterns = { 'pom.xml', 'build.gradle' },
                  filetypes = { 'java' },
                },
              },
            },
            lombok = {
              -- version = 'nightly',
            },
            java_test = {
              enable = true,
              version = '0.43.0',
            },
            java_debug_adapter = {
              enable = true,
              -- version = '0.58.1',
            },
            spring_boot_tools = {
              enable = true,
              version = '1.59.0',
            },
          }
    
    
  4. s1n7ax commented on May 17, 2025

    @s1n7ax
    Member

    Closing this as duplicate. mason 2.0 will be tracked here. Right now we do not support mason 2.0 due an error we ran into while getting package version.
    #384

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