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

Compile issue with big maven project which has multiple moudle #3869

Open
XuPengfei-1020 opened this issue Nov 22, 2024 · 10 comments
Open

Compile issue with big maven project which has multiple moudle #3869

XuPengfei-1020 opened this issue Nov 22, 2024 · 10 comments

Comments

@XuPengfei-1020
Copy link

cannot find symbol
package xxx does not exist
...

What the key point is, if I reopen the vscode or rebuild all projects, the error is changed!
Some errors in A.java this time, it will disappear if I rebuild, meanwhile B.java which previously is all fine but become reported some error this time.
Or if I make some change on pom.xml, the error is gone, but they will come back soon or later....

Am I missing or making wrong config of this extension?
Have you tried some big project like trino or presto in this extension?

@XuPengfei-1020
Copy link
Author

I hive try "clean java language server workspace" several times, issue is still here.
Even some class can not find the symbol in another class which in the same module.
💔

@XuPengfei-1020
Copy link
Author

server.log

@mamilic
Copy link

mamilic commented Nov 22, 2024

Hi @XuPengfei-1020 , I've just tried to import the, https://github.com/trinodb/trino and it works like a charm, imported from first try.

In this extension there is one tricky thing that might be causing this, and it is guessing/setting the java version for compiler to use, as mentioned here. You can navigate to Project Settings by Double Shift and then ">java: open project settings"
#3857 (comment)

If this is the case, then it might be good idea to notify user on the first import whether the Java Version guessed for the project is the correct one. Or perhaps adding to the bottom status bar Java Version used by the project/workspace.

@XuPengfei-1020
Copy link
Author

XuPengfei-1020 commented Nov 23, 2024

@mamilic Thanks you for replay!
But didn't you get much compile error after built project(Trino)?
I get many compile error(more than 1k), and most of them are pertty unreasonable.
Class is just beside but the error told me that it can not be found.

Whats more, you need to run mvn package -pl 'core/trino-grammar' to compile the grammar module which will generate some classes dependend by other modules.
Trino project(master branch) now need jdk23, I checked the project setting and I am sure that I have set it correctly.
It there some wrong setting I made?

@XuPengfei-1020
Copy link
Author

Image

And it want to eat all memory of my laptop while build this big project (I gave the jvm 4g for max heap size).

@XuPengfei-1020
Copy link
Author

Image
So many compile errors after build.

@XuPengfei-1020
Copy link
Author

I found that if a maven dependency which scope is 'test', then it seems can not be resolved correctly.
Almost all of the errors related a 'test' scope maven reference.

@XuPengfei-1020
Copy link
Author

XuPengfei-1020 commented Nov 23, 2024

Found a param "java.import.maven.disableTestClasspathFlag": true, I am trying it, and update here later.

#2569

@mamilic
Copy link

mamilic commented Nov 23, 2024

Hi @XuPengfei-1020 , I was able to import it, and run test but only via "Testing", Image
It took a long time, however as you can see, when I opened the project for second time I got warning in bottom left corner for Java Language Server with error.

Details

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-11-23 13:56:55.426
!MESSAGE Error in calling delegate command handler
!STACK 1
Java Model Exception: Error in Java Model (code 969): trino-docs does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:546)
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2533)
	at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2329)
	at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:2402)
	at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1774)
	at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1765)
	at com.microsoft.jdtls.ext.core.ProjectCommand.getMainClasses(ProjectCommand.java:243)
	at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:35)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:609)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 2024-11-23 13:56:55.426
!MESSAGE trino-docs does not exist

And also I have a buch of JDT compiler issues, Image

But the code navigation somewhat works, as for some methods it takes quite some time to complete the request.
Also, I am using Linux and default JDK is set to Java23.

@XuPengfei-1020
Copy link
Author

Yes, this project is pretty huge, compiling always cost more than 1 hour on my laptop.
What errors we met is mostly referenced by maven whic scope are 'test'.

I set "java.import.maven.disableTestClasspathFlag": true and try it again(after that I run maven package to ensure all the maven reference is downloaded to my local repo) this time, the compiler seems can never finished, it run for several hours, sallow huge memory and boost cpu at high level.
I run clean java server language workspace and try again, it does not changed.
Whats more, I get error:
Image

Anyway, it seems can not take over such huge java maven projects for now, neither for performance nor some critical bugs.
But it is still the best(and alomost only) extension for java language on vscode, I wish it be better and better.

@XuPengfei-1020 XuPengfei-1020 changed the title Compile issue with multiple module maven project Compile issue with big maven project which has multiple moudle Nov 24, 2024
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

2 participants