Skip to content

Multi-Root Workspace with two Maven projects uses wrong pom dependencies #623

Closed

Description

@falco467

VS Code 1.31.1 - Java Test Runner 0.14.0 - Maven for Java 0.14.2

I have two Maven Projects, each with UnitTests. If I open them individually all Tests run without problems. If I open them in a multi-root workspace and run Tests of the second Project, it seems to try and run the Tests with the dependencies of the first Project. The Projects use different Spring versions and the Testrunner tries to run the Tests of the second project using the Spring-Version from the first Project.

What is expected:
Running Tests in a Multi-Root Workspace project with several Maven Projects should use the pom Dependencies of the Project where the Test is located just as if the Root was Opened alone as an individual project.

Activity

  1. jdneo commented on Feb 18, 2019

    @jdneo
    Member

    Falco (@falco467) Thank you for reporting the issue to us.

    May I ask if it is possible for you to share a sample project for us to repro this issue? This will make it much easier to investigate the problem.

  2. falco467 commented on Feb 18, 2019

    @falco467
    Author

    mavenTest.zip

    I have created a minimal example Workspace to reproduce the error.

    The error seems to only happen, if the projects depend on each other:

    Project1 has old version of dependency.
    Project2 has Project1 as dependency and newer version of the library as dependency.

    Testrunner in Project2 somehow loads the old version of the library in multi-root workspace.

  3. jdneo commented on Feb 19, 2019

    @jdneo
    Member

    Falco (@falco467) Thank you! I'll take a look.

  4. jdneo commented on Feb 25, 2019

    @jdneo
    Member

    Falco (@falco467) The root cause looks like the classpath resolved by JDT is wrong. It treats the oldGuava as a project instead of dependency.

    I'll do some more investigation to see if it is possible to implement a method to resolve the classpath instead of calling JavaRuntime.computeDefaultRuntimeClassPath(project)

  5. xhawk18 commented on Apr 18, 2019

    @xhawk18

    fixed ?

  6. yaohaizh commented on Apr 18, 2019

    @yaohaizh
    Contributor

    Sheng Chen (@jdneo) What's the status

  7. jdneo commented on Jun 17, 2019

    @jdneo
    Member

    Update:

    looks like the JavaRuntime.computeDefaultRuntimeClassPath(project) will use DFS to resolve the dependency which is not the case in Maven. Seems the Java debugger has the same problem and Jinbo Wang (@testforstephen) has provided a solution in microsoft/java-debug#281. I will try and see if that change can solve this issue.

  8. added this to the 0.18.1 milestone on Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions