If i call
“
mvn clean install
maven knows that `clean` is a lifecycle and `install` is a phase of the default lifecycle
if i call
mvn deploy
maven will execute all phases of the default lifecycle sequentially.
Is there a way to call the default lifecycle by giving a lifecyle name (instead of executing the last phsae of the lifecycle)?
EDIT: So the question is: is there a command
mvn lifecyclename
“`
that start execution of the default lifecycle?
There is no command to run a lifecycle based on lifecycle name. So you can’t do a mvn Default
and expect it to run upto Default:deploy
. You will have to mention a task of a cycle like test
, package
, clean
and the life-cycle that owns this task will get active.
It does not make sense to have life-cycle as an argument. It will be confusing. For example running mvn clean
is the Clean life-cycle or clean task?
Or, it will be more verbose to type mvn clean
will run Clean life cycle; and mvn clean:clean
will run Clean life cycle until clean task.
Maven has three life cycle. Executing a task (say task_N) of any of the life cycle will result in executing the whole life-cycle until that task (task_N). The three life cycles are Clean, Default, and Site.
For more details see here Introduction to Maven Life-cycles and task order
You see when you execute say, mvn test these are the things gets executed in that order
validate > initialize > generate-sources > process-sources > generate-resources > process-resources > compile > process-classes > post-process > generate-test-sources > process-test-sources > generate-test-resources > process-test-resources > test-compile > process-test-classes > test
You can’t skip any of the default tasks. You may hook plugins that gets gets executed during a task.