Closed GersiD closed 1 year ago
Please note I have tried the following variations for the settings sub table.
settings = {
java = {
project = {
referencedLibraries = {
"C:/Users/gersi/scoop/apps/gradle/current/lib/*.jar",
"C:/Users/gersi/scoop/apps/gradle/current/lib/plugins/*.jar",
},
},
},
},
java = {
project = {
referencedLibraries = {
"C:/Users/gersi/scoop/apps/gradle/current/lib/*.jar",
"C:/Users/gersi/scoop/apps/gradle/current/lib/plugins/*.jar",
},
},
},
project = {
referencedLibraries = {
"C:/Users/gersi/scoop/apps/gradle/current/lib/*.jar",
"C:/Users/gersi/scoop/apps/gradle/current/lib/plugins/*.jar",
},
},
I am a complete amateur when it comes to investigating the inner workings on LSP plugins so please give guidelines on how to provide even more information. I am sure this should be an easy fix for someone who knows what's going on. Thank you for creating nvim-jdtls! I really enjoy the plugin otheriwse :)
You could try removing the referencedLibraries
configuration. Given that your gradle build file contains org.junit.jupiter
as dependency it should pick it up.
E.g. a minimal build.gradle that works for me would look like this:
plugins {
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
application {
mainClass = 'jdtlsdemo.App'
}
tasks.named('test') {
useJUnitPlatform()
}
Hi @mfussenegger Thank you for the response!
So I have moved my config from windows to linux (ubuntu 22.04.2) and the issue persists with a new issue. Now jdtls does not recognize the files in the src/main folder as project files.
The old issue persists, even when removing the referencedLibraries key in the jdtls setup.
Does anything come to mind? The root directory is correct, but I am not sure if jdtls is finding my build.gradle.kts script. How can I verify that this is not the issue. Thank you for developing this plugin!
Java version = openjdk version "17.0.6" 2023-01-17 Gradle version = 7.2
Turns out I'm an idiot and I overcomplicated my setup
Instead of doing the whole cmd = "java" ........ just use cmd = "jdtls". Now it all works no issues whatsoever!
Thanks!
Hmmm I just overcomplicated the configuration as well... So what are the complicate cmd for?
LSP client configuration
Eclipse.jdt.ls version
1.20.0
Steps to Reproduce
In a project using
This project has a build.gradle.kts script which specifies its dependencies.
Open a java file in the src/test directory and import anything from org.junit.jupiter. The import will not be reckognized.
Expected Result
I expect jdtls to find org.junit.jupiter because I have set the following keys in the jdtls setup.
The scoop/apps/gradle/current/lib/ directory contains the jar files for junit. So java should be able to find them.
Actual Result