Before you can start coding in Maven, either to search and fix a bug or to do any enhancements, you will probably be looking for a starting point what code gets executed during a mvn install or a similar call.
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.
The sequence of action is roughly:
- 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.
- 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.
