A Build Lifecycle is Made Up of Phases
A Build Phase is Made Up of Plugin Goals
Goals are executed in phases which help determine the order goals get executed in. The best understanding of this is to look at the default Maven lifecycle bindings which shows which goals get run in which phases by default. The compile phase goals will always be executed before the test phase goals which will always be executed before the package phase goals and so on.
Part of the confusion is exacerbated by the fact that when you execute maven you can specify a goal or a phase. If you specify a phase then maven will run all phases up to the phase you specified in order (e.g. if you specify package it will first run through the compile phase and then the test phase and finally the package phase) and for each phase it will run all goals attached to that phase.
When you create a plugin execution in your Maven build file and you only specify the goal then it will bind that goal to a given default phase. For example, the jaxb:xjc goal binds by default to the generate-resources phase. However, when you specify the execution you can also explicitly specify the phase for that goal as well.
If you specify a goal when you execute Maven then it will still run all phases up to the phase for that goal. In other words, if you specify the jar goal it will run all phases up to the package phase (and all goals in those phases), and then it will run the jar goal.
Life cycle is a sequence of named phases.
Phases executes sequentially. Executing a phase means executes all previous phases.
Plugin is a collection of goals.
Analogy : Plugin is a class and goals are methods within the class.
Build lifecycle is a list of named phases that can be used to give order to goal execution. One of Maven’s standard lifecycles is the default lifecycle, which includes the following phases, in this order:
1 validate
2 generate-sources
3 process-sources
4 generate-resources
5 process-resources
6 compile
7 process-test-sources
8 process-test-resources
9 test-compile
10 test
11 package
12 install
13 deploy