groovy-language-server icon indicating copy to clipboard operation
groovy-language-server copied to clipboard

New Feature: Add support for Gradle based groovy projects.

Open rohitbishnoi opened this issue 5 years ago • 11 comments

rohitbishnoi avatar May 11 '20 09:05 rohitbishnoi

So, what would this involve exactly? Would it just be a matter of parsing the gradle file for the targets/libraries to consume? I think Java language servers already can do this... I might take a look to see if it can be borrowed...

debuos512 avatar Jun 11 '20 14:06 debuos512

The JDT language server is based on Eclipse and says it uses Buildship for Gradle support. Not sure how easy that would be to integrate outside of an Eclipse-based environment.

https://github.com/eclipse/eclipse.jdt.ls

joshtynjala avatar Jun 11 '20 15:06 joshtynjala

What would be the work around for this before this feature is done? say I have all my gradle dependencies in ~/.gradle/caches/modules-2/files-2.1/ Can I manually configure the class path with a glob? Like ~/.gradle/caches/modules-2/files-2.1/**/*

Update: I realize that if I want this ill have to add it as a feature to https://github.com/dansomething/coc-groovy which uses this server.

joshzcold avatar Apr 19 '21 15:04 joshzcold

Based on the solution implemented in the referenced PR by @joshzcold (https://github.com/dansomething/coc-groovy/pull/12), it seems like the challenging part was to get the classpath but from what I understand you can get the classpath via gradlew with:

./gradlew dependencies --configuration compileClasspath

or for the runtime classpath:

./gradlew dependencies --configuration runtimeClasspath

That being said, in typical gradle fashion it only outputs in a pretty human readable way so parsing this might be annoying

shaneikennedy avatar May 28 '24 07:05 shaneikennedy

@shaneikennedy the maintainer of coc-groovy made a script to handle that for the same reason

https://github.com/dansomething/coc-groovy/tree/main/utils%2Fgradle-classpath%2Fbin

He references the built jar of another one of his projects

https://github.com/dansomething/gradle-classpath

joshzcold avatar May 28 '24 13:05 joshzcold

@joshzcold I read the PR but didn't realize that script became it's own repo :) thanks!

shaneikennedy avatar May 29 '24 08:05 shaneikennedy