-
Notifications
You must be signed in to change notification settings - Fork 31
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
lemminx-maven completely ignore local settings #196
Comments
I added some bug to debug such cases to https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.editor.lemminx/HOWTO-DEV.md#how-can-i-debug-the-lemminx-maven-instance-and-m2e-at-the-same-time . Please try that. The piece of code you'd like to place your breakpoint is MavenLemminxExtension#initMavenRequest. |
I like the sentence "I added some bug to debug" :) Some remarks (I may do a PR to update the HOWTO-DEV.md later if needed):
Since I could not start in debug mode, I could not check the problem. In the JSON exchange between server and Eclipse, I can see:
This, then, give a lot of error due to missing version - which is probably due to the bom not being available. I also looked at another pom, which does not a reference a dependency under a bom: no problem there. I suppose there is something done only in case of bom, which trigger the download. Without debug information, is there a way to produce debug stacktrace as in |
My bad, the property is |
Thanks. The method you mentioned is the good one, however, you can't debug it without resorting to tricks: it is called before the debugger session start (if I close all pom.xml, then the LanguageServer close, ... and well, you can't debug something that is closed). This could be a good idea to also a property to suspend the vm (I've found the commit eclipse-wildwebdeveloper/wildwebdeveloper@0a5abb2#diff-4456e8cd4d3f9f5efa224593afe476fd9ea7c4e4d1281fcdd3f53f7f922fff10 ) The best is to put a breakpoint here: org.eclipse.lemminx.extensions.maven.MavenDiagnosticParticipant.doDiagnostics And when it goes into project cache, to remove (using Eclipse) the mavenSession so that it reinitialize again (see trace below):
Then I can see what's the problem. In fact, the maven settings is read from the configured path: https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenLemminxExtension.java#L178 ... but the local repository is forced to a default value in line 184 : https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenLemminxExtension.java#L184 This can be seen by putting a breakpoint on that line, and going into setLocalRepositoryPath: the actual path is the expected one! If I force the parameter localRepositoryPath to the this.localRepositoryPath (eg: so that the setter does nothing), my pom.xml is no longer plagued with errors. As I don't understand the login behind the line 185 to 196, I can only tell that the value should be set only if there is none already set: the settings is always read (once) in any case. I suppose the I also don't know how this behave if I change the settings.xml after the "project cache" is set. I'll try to do a PR if I have time this week: I'll use a NTFS Junction from .m2/repository to my actual repository in the mean time. |
Thanks a lot for the detailed analysis! |
Here the PR. Quite simple but in all honestly, I only have the problem at work, on a citrix desktop. Either the "aether-b2ca945d-f74a-453c-9b63-6d7897a94c75-jackson-bom-2.12.1.pom-in-progress" is not downloaded on my computer, either there is something else. I do think, all thing considered, that it is an error to force the localRepoPath to some default when you already read the settings and those override the default value. |
Yes it is. |
Hello,
I am using version 1.17.0.20201203-1258 (as told by the Window > Help for POM Editor using LemMinX language server / org.eclipse.m2e.lemminx.feature.feature.group).
Because I override the default .m2 local repository and put a file instead (eg: echo "FILE" >"${USERPROFILE}/.m2/repository"), Lemminx Maven is failing because it uses the default repository which I don't want:
To ensure that no one tries to write in
%USERPROFILE%\.m2\repository
, I created a file instead of a directory - hence the error.The problem however is that Lemminx don't take into account the default settings.xml which starts with:
The settings are configured to default in the Eclipse Maven preferences and I've got a lot of dubious warnings:
I think those are related: the Language Server is explicitly ignoring the settings.xml for whatever reason.
The issue #42 was closed without much fixes.
A m2.conf as stated in the #42 could be fine, but I don't see why I would have to do that : my settings is in the default location, and it is not even being read otherwise it would have read the repo path...
Is there a way for me to force it to use the good settings/localRepository ?
How can I diagnose ? (the Language Server logs does not seems to provide hints)
The text was updated successfully, but these errors were encountered: