java-language-server: init at 0.2.38#131262
Conversation
|
Tested on linux using neovim with lspconfig |
2b9d0b6 to
bfd1f4d
Compare
|
Result of 1 package built successfully:
1 suggestion:
|
|
@houstdav000 @winston0410 Would you mind testing the derivation in your editor of choice? It works for me on neovim (with lspconfig) on nixos but I dont know if I may have missed something. All you would have to do is copy the By default, there is an executable called Thanks |
|
@hqurve I am using the exact same config with you, and it is working correctly!👍👍 Btw I have asked the java reddit, and they seems to prefer jdtls over this language server. I will be grateful if you could package that as well. |
|
This is the related issue for |
Great
There are currently two PRs, #99330 and #107424, opened for this; although that its for an older version (I think the current one is 1.2.0). Regardless, I would look at it (even if its just for fun) |
|
Result of 1 package built:
|
raboof
left a comment
There was a problem hiding this comment.
Generally looks good to me. 2 small comments. I wonder if we shouldn't put energy into packaging jdtls instead, if that is preferred over this, though :)
| cat << _EOF > $out/bin/java-language-server | ||
| #!${runtimeShell} | ||
| $out/share/java/java-language-server/lang_server_${platform}.sh "\$@" | ||
| _EOF | ||
| chmod +x $out/bin/java-language-server |
There was a problem hiding this comment.
Is there a reason this needs to be a script and can't be a symlink?
There was a problem hiding this comment.
Yeah, I mentioned it in the comment in the code, but I guess I should expand. Suppose it was a symlink and consider this line in lang_server_linux.sh. According to my testing and this answer, $0 would refer to the symlink and not the target file. Therefore, dirname $0 would evalate to /nix/store/...java-language-server/bin instead of ...../java-language/server/share/java/java-language-server and as you can see this would cause issues in the rest of the code.
Initially, I tried to symlink it but when I noticed this, I only saw two solutions, have a script like how it is done in the AUR or patch the files. I wasn't sure how to properly patch the files in a simple manner, so I resorted to a script.
Please let me know if there is better way to solve this issue (perhaps using symlinks)
There was a problem hiding this comment.
Doh, I should have read more closely :).
perhaps wrapProgram/makeWrapper might be slightly nicer, but that's a matter of taste.
There was a problem hiding this comment.
Thanks, I didnt know such a tool existed
| buildPhase = '' | ||
| runHook preBuild | ||
|
|
||
| mvn package -Dmaven.repo.local=$out/.m2 -DskipTests |
There was a problem hiding this comment.
This is slightly different from the example at https://nixos.org/manual/nixpkgs/unstable/#double-invocation - any reason to use $out/.m2 rather than just $out?
There was a problem hiding this comment.
Looking at it too, none that I could think of. (Perhaps its an artifact of when I was having issues trying to get it to build) Ill change it to just $out.
Also, the reason to skip the tests, the build instructions say to skip them and indeed, I was getting an error when I let them run. (Ill attempt to build it to show you the error)
There was a problem hiding this comment.
I ran the tests and I believe all of the errors were caused by a module not being exported
java.lang.IllegalAccessError: superclass access check failed: class org.javacs.ReusableCompiler$ReusableContext (in unnamed module @0xb6a0f7) cannot access class com.sun.tools.javac.
util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0xb6a0f7
I believe this problem could be mitigated by adding
<arg>--add-exports</arg>
<arg>jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
to each of the dependency compilerArgs in pom.xml but ... ill wait to see what you say
|
Yeah, I agree |
Motivation for this change
Something I would like, also its a packaging request closes #128999
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)