Search code examples
maven-2classloader

Maven plugin classloading


Could anybody please explain how the Core Classloader loads resources when, for instance, surefire test plugin is used?

What I'd especially need to know is the order in which project sources and resources from target/classes + target/test-classes AND project dependencies are loaded.

For instance, if I have a resource which exists both in a project and in a dependency. Which one is loaded first?

Thank you


Solution

  • It turned out the answer was really simple.

    First off, one can see the plugin classpath in the debug mode, $mvn test -X

    And the first entry is target/test-classes, then target/classes and then plugins and all the project dependencies.