eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

"Add Folder to Java Source Path" for Maven and Gradle projects

Open blithefeng opened this issue 4 years ago • 6 comments

I have a big maven project, and there are five modules in it. In my project, one module named "common" is required by the other modules. In "common" module, I have to compile the rpc code and use these codes in other modules. But when using eclipse.jdt.ls in neovim, I couldn't find the definition of the Variable defined in generated-sources. I got response like:

// Failed to get sources. Instead, stub sources have been generated by the disassembler.
 // Implementation of methods is unavailable.
package my.proto;

blithefeng avatar Nov 27 '21 16:11 blithefeng

@blithefeng You may want to take a look at https://github.com/redhat-developer/vscode-java/issues/177

snjeza avatar Nov 27 '21 18:11 snjeza

@snjeza Thanks! I tried to configure build-helper-maven-plugin and it works after compiling the dependent module.

But some projects don't use build-helper-maven-plugin, does eclipse.jdt.sl consider to provide a method like "add to project source"?

blithefeng avatar Nov 29 '21 17:11 blithefeng

There seems to be a context menu item from the explorer menu to Add Folder to Java Source Path but it looks like we don't currently support it if the project is Maven or Gradle :

Unsupported operation. Please use pom.xml file to manage the source directories of maven project.

I'll mark this as a nice enhancement but not sure how high it would be in priorities. If m2e and buildship provide API for these it might be pretty easy to do.

rgrunber avatar Jan 21 '22 17:01 rgrunber

https://github.com/eclipse/eclipse.jdt.ls/issues/964#issuecomment-479903286

As mentioned, would be best if m2e/buildship synced the changes back into the build files.

rgrunber avatar Jan 29 '22 02:01 rgrunber