Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find lombok.jar path #240

Closed
ancion opened this issue Jan 30, 2023 · 8 comments · Fixed by #253
Closed

Could not find lombok.jar path #240

ancion opened this issue Jan 30, 2023 · 8 comments · Fixed by #253

Comments

@ancion
Copy link

ancion commented Jan 30, 2023

Problem : Could not find lombok.jar path

----  client.log ------------------------------
2023-01-30T10:08:17.069 INFO (pid:5376) - Use the JDK from 'java.jdt.ls.java.home' setting as the initial default project JDK.
2023-01-30T10:08:17.260 WARN (pid:5376) - Could not find lombok.jar path.
2023-01-30T10:08:17.301 INFO (pid:5376) - Starting Java server with: F:\jdk17\bin\java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -Dfile.encoding=UTF-8 -Xlog:disable -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Users\unicorn\AppData\Local\coc\extensions\coc-java-data -jar C:\Users\unicorn\AppData\Local\coc\extensions\node_modules\coc-java\server\plugins\org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration C:\Users\unicorn\AppData\Local\coc\extensions\coc-java-data\1.14.0\config_win -data C:\Users\unicorn\AppData\Local\coc\extensions\coc-java-data\jdt_ws
2023-01-30T10:08:17.425 INFO (pid:5376) - WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
---------------------------------------------------------------------

"coc-java" configuration

this should be work with java.jdt.ls.vmargs: "-javaagent:/path/to/lombok.jar" in earlier version. but now it looks like not load this option.

{
   "java.jdt.ls.vmargs": "-javaagent:/path/to/lombok.jar"
} 

Where should I put "lombok.jar" ?

@bertin0
Copy link

bertin0 commented Jan 30, 2023

I also faced during my exam today after I updated without testing the update, but i'm still not sure if it's a jdt.ls issue or something else related to lombok as I can't build stuff with it even with maven.

@alprogs
Copy link

alprogs commented Feb 1, 2023

I've also faced this issue too..
It seems to be the '-javaagent' was disappeared when starting java server.

@amgodoi
Copy link

amgodoi commented Feb 2, 2023

Same problem.
Any workaround?

@alprogs
Copy link

alprogs commented Feb 2, 2023

I didn't see the code in detail, but I can check that I copied lombok.jar to the path below and confirmed that it can be referenced in coc-java.

$ ls ~/.config/coc/extensions/node_modules/coc-java/lombok/lombok.jar
/home/brad/.config/coc/extensions/node_modules/coc-java/lombok/lombok.jar

@Stark-X
Copy link

Stark-X commented Feb 3, 2023

for (const projectUri of projectUris) {
const classpathResult = await apiManager.getApiInstance().getClasspaths(projectUri, { scope: 'test' })
for (const classpath of classpathResult.classpaths) {
if (lombokJarRegex.test(classpath)) {
currentLombokClasspath = classpath
if (activeLombokPath && !isExtensionLombok) {
currentLombokVersion = lombokJarRegex.exec(classpath)[0]
previousLombokVersion = lombokJarRegex.exec(activeLombokPath)[0]
if (currentLombokVersion !== previousLombokVersion) {
versionChange = true
}
}
lombokFound = true
break
}
}
if (lombokFound) {
break
}
}

it seems that there is a new feature to find out the lombok class in the project class path, but something wrong.

How could i write test for the feature or debug that?

@ancion
Copy link
Author

ancion commented Feb 3, 2023

I didn't see the code in detail, but I can check that I copied lombok.jar to the path below and confirmed that it can be referenced in coc-java.

$ ls ~/.config/coc/extensions/node_modules/coc-java/lombok/lombok.jar /home/brad/.config/coc/extensions/node_modules/coc-java/lombok/lombok.jar

this should be work in my windows 11. The coc dictionary is c:/user/name/AppData/Local/coc.
add version lombok.jar --> lombok-${version}.jar could be work well, otherwise get an [coc.error].

@sify21
Copy link

sify21 commented Feb 15, 2023

Confirmed move lombok.jar to ~/.config/coc/extensions/node_modules/coc-java/lombok/lombok-{version}.jar fix the problem, and no need to configure lombok through java.jdt.ls.vmargs. I'm on Mac.

@trev-dev
Copy link

trev-dev commented Mar 3, 2023

I had a look at the upstream vscode extension and found this little diddy: redhat-developer/vscode-java#2887 (comment)

Following guidance from there, I set this up:

{
  "java.jdt.ls.lombokSupport.enabled": false,
  "java.jdt.ls.vmargs": "-javaagent:${env:LOMBOK_JAR} -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable",
}

I have proper lombok support now. Note that ${env:LOMBOK_JAR} is set by nixos in my case, you can go ahead and use an absolute path instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants