Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Maven determine the order goals run in within a given phase?

I understand that Maven has a number of phases that run in the order they are defined for a given lifecycle, and that you can attach goals to a phase.

What happens when you attach a number of goals to a phase, how does Maven determine what order to run the goals in?

like image 365
benstpierre Avatar asked Sep 16 '09 23:09

benstpierre


People also ask

Are Maven goals tied to phases?

A Maven plugin is a group of goals; however, these goals aren't necessarily all bound to the same phase.

What are the Maven phases and goals which ones runs first?

In such a case, Maven runs the resources:resources goal associated with the process-resources phase, then compiler:compile , and so on until it finally runs the surefire:test goal.

How do you run a goal in Maven?

From the main menu, select Run | Edit Configurations to open the run/debug configuration for your project. In the list that opens, select Run Maven Goal. In the Select Maven Goal dialog, specify a project and a goal that you want to execute before launching the project. Click OK.

Where are Maven goals defined?

xml file defines the set of goals to be executed by the maven build. For example, if it's jar then the following phases and goals will be executed. We can also configure goals in the pom. xml file using the plugins element.


1 Answers

From "Introduction to the Build Lifecycle":

The goals that are configured will be added to the goals already bound to the lifecycle from the packaging selected. If more than one goal is bound to a particular phase, the order used is that those from the packaging are executed first, followed by those configured in the POM. Note that you can use the <executions> element to gain more control over the order of particular goals.

like image 93
digiarnie Avatar answered Sep 26 '22 00:09

digiarnie