How to call maven default life cycle

If i call

mvn clean install 

maven knows that clean is the life cycle, and installation is the default life cycle stage.

if i call

 mvn deploy 

maven will sequentially complete all stages of the default life cycle.

Is there a way to invoke the default life cycle by specifying the name lifecyle (instead of executing the last phsae life cycle)?

EDIT: So the question is: is there a team

 mvn lifecyclename 

who start the default life cycle?

+4
source share
3 answers

There seems to be a misunderstanding. Further reading may clarify that

 mvn clean 

does not cause an entire clean life cycle. In fact, there is a pure phase in the pure life cycle. And the team performs this phase, not the life cycle.

+3
source

There is no lifecycle start command based on a lifecycle name. Thus, you cannot make mvn Default and expect it to work before Default:deploy . You should mention a loop task such as test , package , clean , and the life cycle to which this task belongs will become active.

It makes no sense to have a life cycle as an argument. This will be confusing. For example, running mvn clean is a clean life cycle or a clean task?

Or, it will be more verbose to type mvn clean clean life cycle will work; and mvn clean:clean will run a cleanup cycle until clean .


Maven has three life cycles. Executing a task (for example, task_N) of any life cycle will lead to the execution of the entire life cycle before this task (task_N). Three life cycles: Clean, Default, and Site.

For more information, see Introduction to Maven Life Cycles and Task Order.

You see, when you execute say, mvn test are things that are executed in this 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 cannot skip any tasks by default. You can connect plugins that are obtained during the execution of the task.

+6
source

As far as I know, you cannot complete the isolated phase of the life cycle.

But you can fulfill the isolated goal of the plugin.

mvn deploy:deploy

This will not launch any plugin associated with the deploy phase. But you can always add more plugins to the command line. Therefore, I’d better go with a profile that skips all plugins.

If you want to run myplugin:mygoal bound to the deploy phase, then

 mvn myplugin:mygoal deploy:deploy 

But the execution configuration should be in cli.

But you better skip plugins that you don't want. just skip test and integration-test on the command line. But you can achieve this with a profile that sets the configuration for the default loop to skip.

 <profiles> <profile> <id>skip</id> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <skip>true</skip> </configuration> </plugin> ... 

And then call with

 mvn deploy -Pskip 
+1
source

All Articles