Maven uses the Classworlds classloading framework with which we create our classloader graph. If you look in your ${maven.home}/m2/core directory you will see a single JAR which is the classworlds JAR we use to boot the classloader graph. The Classworlds JAR is the only element of the Java $CLASSPATH and Classworlds then builds the following graph of classloaders where the plexus.core classloader, or Realm in Classworlds, is the parent in the context of Maven.
[plexus.core]
${maven.home}/core/*.jar
^
|
|
[plexus.core.maven]
${maven.home}/lib/*.jar
^
|
|
[per plugin]
The top level classloader contains plexus container and plexus utils, and also has access to Classworlds.
The next classloader down the graph contain the core requirements of Maven. In general these are just Maven libraries. We hope to further separate these in the future to just be Maven APIs and have the implementations selected at runtime as required by the system.
After that, each plugin has its own classloader, including its dependencies, itself, and the libraries above. It does not contain the project dependencies as in Maven 1.x, but instead has access to a list of JAR files in case they are needed.
In addition, a project can list extensions. These are loaded into [plexus.maven.core] classloader and so available to the Maven core and all plug-ins for the current project and subsequent projects (in the future, we plan to remove it from subsequent projects).