Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


This document will provide a walk-through of the Maven source code. Please refer to xxx about how to checkout the sources and build Maven yourself.

Entry point: Maven's main method

When called from the command line, the main method of the class org.apache.maven.cli.MavenCli (as in Command Line Interface) will be called.


  • Parse the command line, using the embedded CLIManager class, making use of the Commons CLI
  • Start the Plexus container: embedder.start( classWorld ).
  • Create a Maven Execution Request.
  • Try to execute that request.
  • Have Plexus create a Maven instance. (In most cases this will be org.apache.maven.DefaultMaven.)
  • Have the Maven instance execute the execution request. ( maven.execute(Request) ).

This is where the command line specific invocation ends.

Maven in action: Subjects and Objects

The DefaultMaven instantiates a bunch of objects which interact during the execution of a request.

These are:

  • The ReactorManager (org.apache.maven.execution.ReactorManager)
  • A MavenSession (org.apache.maven.execution.MavenSession)

The session is executed by the LifecycleExecutor (org.apache.maven.lifecycle.LifecycleExecutor).

The ReactorManager

Many users of Maven associate the reactor with multiple project setups, maybe because in a multi-module project, you will see a reactor build order as part of the Maven output. But the ReactorManager is not only used in case of multi-module projects, but also for single projects. 

The MavenSession