'When Maven executes phase or goal or lifecycle?
When I was reading about Maven goals, phases on Stack Overflow, I came across two links in which one says:
when you execute maven you can specify a goal or a phase.
– What is the difference/relation between maven goals and phases?
and the other says:
You can't call the life-cycle-phase itself but you can call the goals of the plugins which are bound to the life-cycle-phases.
Which one is right? Or am I not understanding it?
Also can some give me simple examples Maven executing lifecycle/phase/goal.
And also Maven knows that it has to run phase or a goal? E.g. when I say mvn install, is it install phase or goal?
Solution 1:[1]
When you invoke a single plugin, you need to invoke a goal of that plugin. Like
mvn dependency:tree
in this case you are invoking the goal tree of the dependency plugin
On the other hand, you can invoke a phase of maven by simply doing
mvn test
In this case you are invoking not a plugin but a phase. Note that plugin goals can be bound to specific phases as well. The difference is whether you invoke the full phase (and all the preceding phases implicitly) or just a single goal of a single plugin
Here you can find all the phases of the default lifecycle (which can be modified, but i don't think you need to know about that for now), so as you can see, install is a phase
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
