Search code examples
javamavenmaven-3

Maven lifecycle and plugins


While reading about maven lifecycles and plugins , I have the following short doubts about maven , so posting in one thread :

1) Can we have our custom lifecycle in maven ?

2) Can we add custom phases to a pre existing life cycle in maven ?

3) Can a phase be associated to 2 or more goals at once ? If yes, how will maven decide the order of execution of the goals ?

4) Can a goal be associated to 2 or more phases ?

I am expecting short answers to each not any in depth explanation , however , if some body can provide that too , it will be awesome. I just don't want my question to be marked as too broad.


Solution

  • You can define custom lifecycles, but it is rarely useful. I have never done it. I would avoid it if possible.

    You can add an arbitrary amount of goals to a phase. AFAIK, they are executed in the order they are given. You can also add a goal to different phases.