1- *nvim-java.txt* For Neovim >= 0.9.4 Last change: 2025 February 16
1+ *nvim-java.txt* For Neovim >= 0.9.4 Last change: 2025 December 03
22
33==============================================================================
44Table of Contents *nvim-java-table-of-contents*
@@ -20,18 +20,16 @@ Table of Contents *nvim-java-table-of-contents*
2020
2121
2222
23- Just install and start writing `public static void main(String[] args)`.
2423
2524
26- [!CAUTION] You cannot use `nvim- java` alongside `nvim- jdtls` . So remove
27- `nvim- jdtls` before installing this
25+ ------------------------------------------------------------------------------
26+ Just install and start writing `public static void main(String[] args)`.
27+
28+ ------------------------------------------------------------------------------
2829
2930 [!TIP] You can find cool tips & tricks here
3031 https://github.com/nvim-java/nvim-java/wiki/Tips-&-Tricks
3132
32- [!NOTE] If you are facing errors while using, please check troubleshoot wiki
33- https://github.com/nvim-java/nvim-java/wiki/Troubleshooting
34-
3533DEMO *nvim-java-demo*
3634
3735
@@ -46,34 +44,50 @@ FEATURES *nvim-java-features*
4644- Organize Imports & Code Formatting
4745- Running Tests
4846- Run & Debug Profiles
47+ - Built-in Application Runner with Log Viewer
48+ - Profile Management UI
49+ - Decompiler Support
4950- Code Actions <https://github.com/nvim-java/nvim-java/wiki/Tips-&-Tricks#running-code-actions >
5051
5152
5253HOW TO INSTALL *nvim-java-how-to-install*
5354
5455:small_orange_diamond:details ~
5556
57+ **Requirements:** Neovim 0.11+
5658
57- CUSTOM CONFIGURATION INSTRUCTIONS ~
58-
59- - Install the plugin
6059
61- Using lazy.nvim < https://github.com/folke/lazy.nvim >
60+ USING VIM.PACK ~
6261
6362>lua
64- return {'nvim-java/nvim-java'}
63+ vim.pack.add({
64+ {
65+ src = 'https://github.com/JavaHello/spring-boot.nvim ',
66+ version = '218c0c26c14d99feca778e4d13f5ec3e8b1b60f0',
67+ },
68+ 'https://github.com/MunifTanjim/nui.nvim ',
69+ 'https://github.com/mfussenegger/nvim-dap ',
70+
71+ 'https://github.com/nvim-java/nvim-java ',
72+ })
73+
74+ require('java' ).setup()
75+ vim.lsp.enable('jdtls' )
6576<
6677
67- - Setup nvim-java before `lspconfig`
6878
69- >lua
70- require('java' ).setup()
71- <
79+ USING LAZY.NVIM ~
7280
73- - Setup jdtls like you would usually do
81+ Install using lazy.nvim < https://github.com/folke/lazy.nvim >:
7482
7583>lua
76- require('lspconfig' ).jdtls.setup({})
84+ {
85+ 'nvim-java/nvim-java',
86+ config = function()
87+ require('java' ).setup()
88+ vim.lsp.enable('jdtls' )
89+ end,
90+ }
7791<
7892
7993Yep! That’s all :)
@@ -282,44 +296,20 @@ HOW TO USE JDK X.X VERSION? *nvim-java-how-to-use-jdk-x.x-version?*
282296
283297:small_orange_diamond:details ~
284298
285-
286- METHOD 1 ~
287-
288- Neoconf <https://github.com/folke/neoconf.nvim > can be used to manage LSP
289- setting including jdtls. Neoconf allows global configuration as well as project
290- vice configurations. Here is how you can set Jdtls setting on `neoconf.json`
291-
292- >json
293- {
294- "lspconfig": {
295- "jdtls": {
296- "java.configuration.runtimes": [
297- {
298- "name": "JavaSE-21",
299- "path": "/opt/jdk-21",
300- "default": true
301- }
302- ]
303- }
304- }
305- }
306- <
307-
308-
309- METHOD 2 ~
310-
311- Pass the settings to Jdtls setup.
299+ Use `vim .lsp .config ()` to override the default JDTLS settings:
312300
313301>lua
314- require('lspconfig' ).jdtls.setup({
315- settings = {
316- java = {
317- configuration = {
318- runtimes = {
319- {
320- name = "JavaSE-21",
321- path = "/opt/jdk-21",
322- default = true,
302+ vim.lsp.config('jdtls' , {
303+ default_config = {
304+ settings = {
305+ java = {
306+ configuration = {
307+ runtimes = {
308+ {
309+ name = "JavaSE-21",
310+ path = "/opt/jdk-21",
311+ default = true,
312+ }
323313 }
324314 }
325315 }
@@ -334,88 +324,58 @@ CONFIGURATION *nvim-java-configuration*
334324:small_orange_diamond:details ~
335325
336326For most users changing the default configuration is not necessary. But if you
337- want, following options are available
327+ want, following options are available:
338328
339329>lua
340- {
341- -- list of file that exists in root of the project
342- root_markers = {
343- 'settings.gradle',
344- 'settings.gradle.kts',
345- 'pom.xml',
346- 'build.gradle',
347- 'mvnw' ,
348- 'gradlew' ,
349- 'build.gradle',
350- 'build.gradle.kts',
351- '.git',
330+ require('java' ).setup({
331+ -- Startup checks
332+ checks = {
333+ nvim_version = true, -- Check Neovim version
334+ nvim_jdtls_conflict = true, -- Check for nvim-jdtls conflict
352335 },
353336
337+ -- JDTLS configuration
354338 jdtls = {
355- version = 'v1 .43.0',
339+ version = '1 .43.0',
356340 },
357341
342+ -- Extensions
358343 lombok = {
359- version = 'nightly' ,
344+ enable = true,
345+ version = '1.18.40',
360346 },
361347
362- -- load java test plugins
363348 java_test = {
364349 enable = true,
365350 version = '0.40.1',
366351 },
367352
368- -- load java debugger plugins
369353 java_debug_adapter = {
370354 enable = true,
371- version = '0.58.1 ',
355+ version = '0.58.2 ',
372356 },
373357
374358 spring_boot_tools = {
375359 enable = true,
376360 version = '1.55.1',
377361 },
378362
363+ -- JDK installation
379364 jdk = {
380- -- install jdk using mason.nvim
381365 auto_install = true,
382- version = '17.0.2 ',
366+ version = '17',
383367 },
384-
385- -- We do multiple verifications to make sure things are in place to run this
386- -- plugin
387- verification = {
388- -- nvim-java checks for the order of execution of following
389- -- * require('java' ).setup()
390- -- * require('lspconfig' ).jdtls.setup()
391- -- IF they are not executed in the correct order, you will see a error
392- -- notification.
393- -- Set following to false to disable the notification if you know what you
394- -- are doing
395- invalid_order = true,
396368
397- -- nvim-java checks if the require('java' ).setup() is called multiple
398- -- times.
399- -- IF there are multiple setup calls are executed, an error will be shown
400- -- Set following property value to false to disable the notification if
401- -- you know what you are doing
402- duplicate_setup_calls = true,
403-
404- -- nvim-java checks if nvim-java/mason-registry is added correctly to
405- -- mason.nvim plugin.
406- -- IF it's not registered correctly, an error will be thrown and nvim-java
407- -- will stop setup
408- invalid_mason_registry = false,
369+ -- Logging
370+ log = {
371+ use_console = true,
372+ use_file = true,
373+ level = 'info' ,
374+ log_file = vim.fn.stdpath('state' ) .. '/nvim-java.log',
375+ max_lines = 1000,
376+ show_location = false,
409377 },
410-
411- mason = {
412- -- These mason registries will be prepended to the existing mason
413- -- configuration
414- registries = {
415- 'github:nvim-java/mason-registry',
416- },
417- },
418- }
378+ })
419379<
420380
421381
@@ -486,9 +446,6 @@ PROJECTS ACKNOWLEDGEMENT *nvim-java-projects-acknowledgement*
486446 follows "Keep it simple, stupid!" approach. If you love customizing things by
487447 yourself, then give nvim-jdtls a try.
488448
489-
490- [!WARNING ] You cannot use `nvim- java` alongside `nvim- jdtls` . So remove
491- `nvim- jdtls` before installing this
492449==============================================================================
4934502. Links *nvim-java-links*
494451
@@ -498,6 +455,9 @@ PROJECTS ACKNOWLEDGEMENT *nvim-java-projects-acknowledgement*
4984554. *Apache Maven*: https://img.shields.io/badge/Apache%20Maven-C71A36?style=for-the-badge&logo=Apache%20Maven&logoColor=white
4994565. *Neovim*: https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white
5004576. *Lua*: https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white
458+ 7. *Linux*: https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black
459+ 8. *Windows*: https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows11&logoColor=white
460+ 9. *macOS*: https://img.shields.io/badge/macOS-000000?style=for-the-badge&logo=apple&logoColor=white
501461
502462Generated by panvimdoc <https://github.com/kdheepak/panvimdoc >
503463
0 commit comments