Dhruva Reddy wrote:
What exactly is a goal and what is a phase?
In maven 1, there were only goals, and goals were specific targets that were embedded in specific maven plugins, a bit like an ant target.
So the jar plugin would have the jar goal which when run, would jar up some classes.
It soon became apparent that this leaves too much up to the end user: what if the artifact you are producing isn't a jar, but an ear instead? Or a war file? Why should the user have to know or care that they must run the ear:ear goal instead of the jar:jar goal?
Enter the phases of the lifecycle in maven 2.Plugins attach various goals to the various phases in the lifecycles, and depending on which phase of the lifecycle you've asked maven to complete, all the relevant goals attached to that lifecycle will be run up to that phase.
So if you run "mvn install" (or "run all goals in all phases up until the 'install' phase"), maven figures out for itself that the compile:compile goal must run, and the ear:ear goal (because the artifact is an ear file), the user no longer needs to care.
So to sum up:The lifecycle contains a list of phases, and each phase has a goal or goals attached to that phase. So running a phase is a convenient way of saying "run all goals I need to run to make this artifact up to this phase, and don't tell me what those goals are, I don't care".
Regards, Graham --
smime.p7s
Description: S/MIME Cryptographic Signature
