@@ -57,26 +57,40 @@ You can click on **n commits ahead of** link to see the changes made on top of t
5757- [ Kickstart] ( https://github.com/nvim-java/starter-kickstart )
5858- [ AstroNvim] ( https://github.com/nvim-java/starter-astronvim )
5959
60- ### Custom Configuration Instructions
60+ ### Manual Installation Instructions
6161
62- - Install the plugin
62+ ** Requirements: ** Neovim 0.11+
6363
64- Using [ lazy.nvim ] ( https://github.com/folke/lazy.nvim )
64+ #### Using ` vim.pack `
6565
6666``` lua
67- return {' nvim-java/nvim-java' }
68- ```
67+ vim .pack .add ({
68+ {
69+ src = ' https://github.com/JavaHello/spring-boot.nvim' ,
70+ version = ' 218c0c26c14d99feca778e4d13f5ec3e8b1b60f0' ,
71+ },
72+ ' https://github.com/MunifTanjim/nui.nvim' ,
73+ ' https://github.com/mfussenegger/nvim-dap' ,
6974
70- - Setup nvim-java before ` lspconfig `
75+ ' https://github.com/nvim-java/nvim-java' ,
76+ })
7177
72- ``` lua
7378require (' java' ).setup ()
79+ vim .lsp .enable (' jdtls' )
7480```
7581
76- - Setup jdtls like you would usually do
82+ #### Using ` lazy.nvim `
83+
84+ Install using [ lazy.nvim] ( https://github.com/folke/lazy.nvim ) :
7785
7886``` lua
79- require (' lspconfig' ).jdtls .setup ({})
87+ {
88+ ' nvim-java/nvim-java' ,
89+ config = function ()
90+ require (' java' ).setup ()
91+ vim .lsp .enable (' jdtls' )
92+ end ,
93+ }
8094```
8195
8296Yep! That's all :)
@@ -282,42 +296,20 @@ require('java').settings.change_runtime()
282296
283297<summary >:small_orange_diamond:details</summary >
284298
285- ### Method 1
286-
287- [ Neoconf] ( https://github.com/folke/neoconf.nvim ) can be used to manage LSP
288- setting including jdtls. Neoconf allows global configuration as well as project-wise
289- configurations. Here is how you can set Jdtls setting on ` neoconf.json `
290-
291- ``` json
292- {
293- "lspconfig" : {
294- "jdtls" : {
295- "java.configuration.runtimes" : [
296- {
297- "name" : " JavaSE-21" ,
298- "path" : " /opt/jdk-21" ,
299- "default" : true
300- }
301- ]
302- }
303- }
304- }
305- ```
306-
307- ### Method 2
308-
309- Pass the settings to Jdtls setup.
299+ Use ` vim.lsp.config() ` to override the default JDTLS settings:
310300
311301``` lua
312- require (' lspconfig' ).jdtls .setup ({
313- settings = {
314- java = {
315- configuration = {
316- runtimes = {
317- {
318- name = " JavaSE-21" ,
319- path = " /opt/jdk-21" ,
320- 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+ }
321313 }
322314 }
323315 }
@@ -335,94 +327,63 @@ require('lspconfig').jdtls.setup({
335327<summary >:small_orange_diamond:details</summary >
336328
337329For most users changing the default configuration is not necessary. But if you
338- want, following options are available
330+ want, following options are available:
339331
340332``` lua
341- {
342- -- list of file that exists in root of the project
343- root_markers = {
344- ' settings.gradle' ,
345- ' settings.gradle.kts' ,
346- ' pom.xml' ,
347- ' build.gradle' ,
348- ' mvnw' ,
349- ' gradlew' ,
350- ' build.gradle' ,
351- ' build.gradle.kts' ,
352- ' .git' ,
333+ require (' java' ).setup ({
334+ -- Startup checks
335+ checks = {
336+ nvim_version = true , -- Check Neovim version
337+ nvim_jdtls_conflict = true , -- Check for nvim-jdtls conflict
353338 },
354339
340+ -- JDTLS configuration
355341 jdtls = {
356- version = ' v1 .43.0' ,
342+ version = ' 1 .43.0' ,
357343 },
358344
345+ -- Extensions
359346 lombok = {
360- version = ' nightly' ,
347+ enable = true ,
348+ version = ' 1.18.40' ,
361349 },
362350
363- -- load java test plugins
364351 java_test = {
365352 enable = true ,
366353 version = ' 0.40.1' ,
367354 },
368355
369- -- load java debugger plugins
370356 java_debug_adapter = {
371357 enable = true ,
372- version = ' 0.58.1 ' ,
358+ version = ' 0.58.2 ' ,
373359 },
374360
375361 spring_boot_tools = {
376362 enable = true ,
377363 version = ' 1.55.1' ,
378364 },
379365
366+ -- JDK installation
380367 jdk = {
381- -- install jdk using mason.nvim
382368 auto_install = true ,
383- version = ' 17.0.2 ' ,
369+ version = ' 17' ,
384370 },
385371
372+ -- Notifications
386373 notifications = {
387- -- enable 'Configuring DAP' & 'DAP configured' messages on start up
388- dap = true ,
374+ dap = true , -- Show DAP configuration messages
389375 },
390376
391- -- We do multiple verifications to make sure things are in place to run this
392- -- plugin
393- verification = {
394- -- nvim-java checks for the order of execution of following
395- -- * require('java').setup()
396- -- * require('lspconfig').jdtls.setup()
397- -- IF they are not executed in the correct order, you will see a error
398- -- notification.
399- -- Set following to false to disable the notification if you know what you
400- -- are doing
401- invalid_order = true ,
402-
403- -- nvim-java checks if the require('java').setup() is called multiple
404- -- times.
405- -- IF there are multiple setup calls are executed, an error will be shown
406- -- Set following property value to false to disable the notification if
407- -- you know what you are doing
408- duplicate_setup_calls = true ,
409-
410- -- nvim-java checks if nvim-java/mason-registry is added correctly to
411- -- mason.nvim plugin.
412- -- IF it's not registered correctly, an error will be thrown and nvim-java
413- -- will stop setup
414- invalid_mason_registry = false ,
377+ -- Logging
378+ log = {
379+ use_console = true ,
380+ use_file = true ,
381+ level = ' info' ,
382+ log_file = vim .fn .stdpath (' state' ) .. ' /nvim-java.log' ,
383+ max_lines = 1000 ,
384+ show_location = false ,
415385 },
416-
417- mason = {
418- -- These mason registries will be prepended to the existing mason
419- -- configuration
420- registries = {
421- ' github:nvim-java/mason-registry' ,
422- },
423- },
424- }
425-
386+ })
426387```
427388
428389</details >
@@ -497,7 +458,3 @@ For instance, to run the current test,
497458- [ nvim-jdtls] ( https://github.com/mfussenegger/nvim-jdtls ) is a plugin that follows
498459 "Keep it simple, stupid!" approach. If you love customizing things by yourself,
499460 then give nvim-jdtls a try.
500-
501- > [ !WARNING]
502- > You cannot use ` nvim-java ` alongside ` nvim-jdtls ` . So remove ` nvim-jdtls `
503- > before installing this
0 commit comments