redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 440 forks source link

Gradle projects compile to `bin/` instead of `build/` #2338

Open brunovieira97 opened 2 years ago

brunovieira97 commented 2 years ago

Gradle projects default their builds to build/, however the vscode plugin compiles a completely separate version of all the class files to bin/, so it does require adding a completely separate directory to source control, along with actually performing all the compiles twice (once for gradle, and once for vscode).

Originally posted by @ThadHouse in https://github.com/redhat-developer/vscode-java/issues/466#issuecomment-373542235

brunovieira97 commented 2 years ago

Was looking for a solution for my problem when I stumbled upon this mentioned comment.

The problem here is the Java extension for VS Code compiles binaries to bin/ directly.

Is there a way for VS Code to follow Gradle's settings for the build folder?

snjeza commented 2 years ago

@brunovieira97 You may want to take a look at https://github.com/eclipse/buildship/issues/1131

brunovieira97 commented 2 years ago

Wasn't aware of this Buildship project.

However, Maven support does not seem to be affected at all. AFAIK, it just compiles binaries directly to target/, same as Eclipse (in this case, VS Code).

snjeza commented 2 years ago

Wasn't aware of this Buildship project.

See

Lassebq commented 2 months ago

I don't think java extension even uses gradle to build these classes. I have registered a task with

classes.finalizedBy mergeMethods

And none of the changes got applied by this task. Additionally, debug extension uses bin/ for runtime classpath which caused issues due to my task not applying these changes