You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dependency mediation - this determines what version of an artifact will be chosen when multiple versions are encountered as dependencies. Maven picks the "nearest definition". That is, it uses the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM. Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins.
"nearest definition" means that the version used will be the closest one to your project in the tree of dependencies. For example, if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0.
When there are multiple versions for the same dependency existed in the dependency tree, maven will use BFS algorithm to use the nearest version as the target one.
Currently, java-debug used DFS algorithm to determine the dependency, that's the reason why the wrong JAR is added to the classpath. We will take advantage of the same mechanism as what maven did.
Activity
yaohaizh commentedon Apr 16, 2019
Jinbo Wang (@testforstephen) Could you help take a look at this issue?
testforstephen commentedon Apr 17, 2019
i can reproduce the issue, should be a bug.
yaohaizh commentedon Apr 18, 2019
Sheng Chen (@jdneo) Is this the same issue that tester fixed?
rcl4444 commentedon May 12, 2019
I also encountered this problem.
rcl4444 commentedon May 12, 2019
in My situation, the Different versions exist simultaneously in the -cp arguments..
testforstephen commentedon Jun 14, 2019
When there are multiple versions for the same dependency existed in the dependency tree, maven will use BFS algorithm to use the nearest version as the target one.
Currently, java-debug used DFS algorithm to determine the dependency, that's the reason why the wrong JAR is added to the classpath. We will take advantage of the same mechanism as what maven did.
testforstephen commentedon Jul 2, 2019
A new release is ready in vscode marketplace. Have a try!
//Adam Peck (@dampcake) rcl4444