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

eclipse.jdt.ls doesn't respect Gradle output directory #1400

Open
dradtke opened this issue Apr 1, 2020 · 7 comments
Open

eclipse.jdt.ls doesn't respect Gradle output directory #1400

dradtke opened this issue Apr 1, 2020 · 7 comments

Comments

@dradtke
Copy link

dradtke commented Apr 1, 2020

Gradle by default uses build as its output directory, and Eclipse uses bin, but it doesn't look like there's a way to tell the language server to use Gradle's settings without installing a separate Eclipse plugin. This has caused me problems when updating resources; the processResources task copies files over to build, but the language server can't see them because it's using bin.

@fbricon
Copy link
Contributor

fbricon commented Apr 1, 2020

Gradle support is provided by the Buildship project. Separating the output directories of Eclipse and CLI builds is a design decision, basically to prevent conflicts between IDE and CLI builds. More about here: https://discuss.gradle.org/t/eclipse-plugin-did-not-configure-default-output-directory-to-build/7586.

Adding @rubensa's comment from redhat-developer/vscode-java#1187 (comment) :

I ended with this configuration in my build.gradle so gradle build on "build/gradle" and eclipse on "build/eclipse":

buildDir = "build/gradle"
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
  classpath {
    defaultOutputDir = file('build/eclipse')
    file.whenMerged {
      entries.each { entry ->
        if (entry.kind == 'src' && entry.hasProperty('output')) {
          entry.output = entry.output.replace('bin/', "build/eclipse/")
        }
      }
    }
  }
}

@dradtke
Copy link
Author

dradtke commented Apr 1, 2020

That makes sense, but wouldn't it also make sense for the language server to override Buildship's default setting? Users of the server will be working with Gradle (or whatever the build system is) and not Eclipse directly.

@fbricon
Copy link
Contributor

fbricon commented Apr 1, 2020

to prevent conflicts between IDE and CLI builds.

This applies to jdt.ls clients too, they're the IDEs, they will see the conflicts

@dradtke
Copy link
Author

dradtke commented Apr 1, 2020

Is there a language server command for refreshing the build that I'm not aware of? I ran into this issue because I was running tests through java-debug, one failed due to an issue in a resource file, and the language server didn't pick up the resource change once I fixed it. The test kept failing until I either restarted the language server, or ran processResources and manually copied resources from build over to bin.

@yotkamen
Copy link

yotkamen commented Apr 6, 2021

Any solution or workaround for this problem. We use Gradle at work and Emacs fails to dap-debug for example as it searches for classes in the bin directory. I am not sure what else fails - perhaps it runs slower. Anyway, I managed to workaround the dap-debug problem by manually copying from build to bin, while respecting the destination locations. I'm considering automating the copy. Apart from that do you have any concerns/suggestions regarding this approach?

@dradtke
Copy link
Author

dradtke commented Apr 10, 2021

Yeah, there's a poorly-documented command java/buildWorkspace, which helps in my case, as long as I forced a full rebuild.

@CsCherrYY
Copy link
Contributor

related to eclipse-buildship/buildship#1131

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

No branches or pull requests

4 participants