Irbis
Irbis

Reputation: 1511

mvn lifecycle command line - how to start a lifecycle from the particular phase

I can disable the particular phase in pom: Disable phases in Maven lifecycle. It is possible to disable test from the command line: -Dmaven.test.skip=true Is it possible to start mvn lifecycle from the particular phase, for example compile using only the command line options ?

Upvotes: 1

Views: 230

Answers (1)

pobu
pobu

Reputation: 402

By default, a lifecycle is as follows (from Introduction to the Build Lifecycle):

  1. validate - validate the project is correct and all necessary information is available
  2. compile - compile the source code of the project
  3. test - test the compiled source code using a suitable unit testing framework
  4. package - take the compiled code and package it in its distributable format, such as a JAR
  5. verify - run any checks on results of integration tests to ensure quality criteria are met
  6. install - install the package into the local repository, for use as a dependency in other projects locally
  7. deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

While we can build applications without automated testing, we can't execute the package phase without an earlier code compilation. Just as we are not able to install the package into the local repository without the .jar/.war packages, that are created in package phase.

For compilation you can use Apache Maven Compiler Plugin.

Then you can run compilation by executing

mvn compile

The command will execute maven goal compiler:compile

Upvotes: 1

Related Questions