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

Multi module maven project #159

Open
GabCamarda opened this issue Sep 22, 2019 · 14 comments
Open

Multi module maven project #159

GabCamarda opened this issue Sep 22, 2019 · 14 comments

Comments

@GabCamarda
Copy link

I was wondering what is the best way to setup lsp-java in a multi module maven project. It is a mono repo with about 50 services in it, each configured as maven project. I was able to setup the root as the main root of the whole project (the parent maven config), however it takes a while to index all the files and most of the time it throws an "out of memory" error. Increasing the heap size of the VM helps to avoid this problem, however it still takes a long time to build the workspace, during which most of the features I benefit from using lsp-java are unusable.
I also disabled file watchers to speed up the process. For reference, using IntelliJ rarely lags.

I appreciate my project has a lot of files and the process of indexing them all is inevitably slower, but Is there anything I can do to help speed up the process at all?

p.s.: thanks for the great work!

@yyoncho
Copy link
Member

yyoncho commented Sep 23, 2019

You may try import only a limited set of services e. g. do not import the root and then either put .projectile in the service root.

If this is not an option and JDT LS parsing is taking a lot of time, I do not think that there is anything that we can do on emacs side but we should report the issue upstream. IIRC there was a user that reported that he successfully uses lsp-java on 6000+.

@GabCamarda
Copy link
Author

Thanks, I've tried that already, however by doing so I cannot jump to file definitions outside of the root. And sometimes that is needed. Unless I'm missing something?

@yyoncho
Copy link
Member

yyoncho commented Sep 23, 2019

It should be possible to make it work if the other projects are compiled and their source is available in the local .m2 repository. Also, it is possible to attach the source locations in jdtls but this is not exposed in lsp-java - #71

@GabCamarda
Copy link
Author

Yeah I usually build the project at first to make sure all sources are generated. I'll give this a try. Any plans on implementing the "attach source" feature?

@yyoncho
Copy link
Member

yyoncho commented Sep 23, 2019

Any plans on implementing the "attach source" feature?

Not in the next few weeks, but if you want to give it a hit feel free to ping me.

@GabCamarda
Copy link
Author

Thanks, I doubt my Lisp can be of any help here, but I can sure give it a try on my spare time.

@yyoncho
Copy link
Member

yyoncho commented Oct 7, 2019

@GabCamarda
Copy link
Author

Nice, when can we expect this added to lsp-mode/lsp-java ?

@yyoncho
Copy link
Member

yyoncho commented Oct 8, 2019

First, the PR should be merged in jdt ls and then it is a single liner in lsp-java - register the configuration settings like we register the rest of the configuration settings.

@GabCamarda
Copy link
Author

see redhat-developer/vscode-java#1084 and corresponding PR eclipse/eclipse.jdt.ls#1200

The PR has been merged

@yyoncho
Copy link
Member

yyoncho commented Oct 17, 2019

Here it is a guide how to expose server property: https://github.com/emacs-lsp/lsp-mode#sections

@nipuna-perera
Copy link

What was the resolution to this? I have a similar large multi module project but I don't want lsp context to switch every time I open a file in a submodule. How do I pin the root(parent) folder as project root for the project? I haven't found a good solution for this online.

@yyoncho
Copy link
Member

yyoncho commented Mar 24, 2022

How do I pin the root(parent) folder as project root for the project?

@nipuna-perera you can import the folder containing the root pom and it should work.

@nipuna-perera
Copy link

I tried that. It didn't work. I deleted the lsp-session file, then when I was prompted, I chose "Interactively select root". Then picked pom.xml of my parent. Still when I pick a file from a submodule, the LSP server shows that it's starting, meaning it picked a different project. When I invoke projectile-find-file I only see selections from the submodule.

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

No branches or pull requests

3 participants