Get an introduction to the Maven build lifecycle.
- [Instructor] The Maven Build Lifecycle is made up of three main lifecycles, each of which serves a distinct purpose. The three built-in lifecycles are default, clean, and site. The default life cycle is the main one that is used for project build and deployment. The clean lifecycle we've seen as well in our commands, and it is responsible for cleaning the project, specifically, the target directory. The site lifecycle we have also seen, and it is responsible for generating all of the site documentation. Each lifecycle is made up of phases. Let's dig into phases a little bit by looking at the default phases. But first, we need to understand that a phase is a stage or a step in the lifecycle. The default lifecycle, for instance, has phases for validation, compilation, testing, packaging, verification, installation, and deployment. For instance, earlier, when we called the Maven clean package, we wanted to execute the clean lifecycle. Then, in the build lifecycle, we wanted to run up to and including, the package phase. You must execute all phases in order so you get every phase in a lifecycle, up to and including, the one that you call with your Maven command. Phases themselves are made up of goals. Goals are individual tasks within a phase. More specifically, goals of a plugin are bound to a phase in the lifecycle. Goals can be triggered on plugins individually. For instance, the dependency plugin has a dependency analyze goal. This can be triggered on the project from the command line and it will tell you the status of your dependencies. And we're going to look at this one a little bit more detailed later on, but, this is a very useful dependency goal because it will allow you to ensure that you are declaring the dependencies you are using, as well as not loading jars that you don't need. Goals can be very useful during development, especially when you don't want to run full phases just to get the output of a specific plugin, let's say, like Surefire.
- Exploring POM files
- The build life cycle
- Using build plugins
- Dependency management with Maven
- Maven reporting
- Working with Maven sites