-
Notifications
You must be signed in to change notification settings - Fork 874
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
Improve priming from LSP client #7063
Conversation
Fixing the test was more tough than I expected. Why it failed: the Maven Problems inspector traverses artifacts (project.getArtifacts()), direct dependencies. Notes those that are not locally available. Earlier commits in this fix added "faked" artifacts created during project read. But I didn't pay attention to that these fakes are only created for POMs - not jars, but metadata of those jars. The resolver wrappers introduced by aaeabe1 allows to trace POM request back to the original artifact (which may have pom packaging !) and report that one. Final normalization of the missing artiact is done by ignoring artifact scope, as the scope is somewhat lost during the artifact resolution process - but it does not matter, the artifact was touched and needed during the project read. Without these steps, the Problems view either does not catch all problems, or displays duplicities (the same artifact in default and compile scope, for example). Maybe the problem reporter could be rewritten to use recursive dependencies, or rely on Maven reading infrastructure with catching errors in resolver wrappers, so the info comes from a single source. |
c261808
to
301fc75
Compare
Rebased on latest master - |
@sdedic I haven't checked since when it happened and it might not be related to the priming changes here, but the micronaut tests throw NPEs during priming while green: |
Will check, thanks for the alert. |
In Oracle Luna Labs environment, where Apache NBLS runs alongside Microsoft Java support, we've encountered an interesting situation:
So this fix contains two changes. Changes project analysis (1) in that not only direct dependencies, but indirect ones, too, will cause the project to be marked as "broken", suggesting to run a priming build (to download dependencies). This might be useful, since in NB21, when the user adds a dependency to
pom.xml
, it is not really visible in completion unless the dependency happens to be in the local repository - until the next build. This fixes (2).And the second fix modifies (3) in that each newly discovered subproject is checked for priming action and potentially primed. The subproject check is then done again ... and again until the closure is searched fully.
Note that the parent primes first (if possible), so chances are all children will be primed during this process. And children are always processed only after the parent primes.
The 2nd+ child level processing will happen if the local repository is partially populated in a way that satisfies the parent (parent load does not notice any issues), but NOT the subprojects - this may be the case even after (1) is improved by this PR. This fixes (4).