Maven Combat (iv) life cycle

Source: Internet
Author: User

1. Three sets of life cycle
MAVEN has three sets of independent life cycles, Clean,default and site respectively.
Each lifecycle contains stages, which are sequential, and the subsequent phases depend on the previous phase, and the most direct interaction between users and Maven is to invoke these lifecycle stages.
Take the clean life cycle as an example, it contains Pre-clean, clean and post clean. When the user invokes Pre-clean, only Pre-clean is executed, and when the user invokes clean, the Pre-clean and clean phases are executed sequentially; When the user invokes Post-clean, Pre-clean,clean, Post-clean will be executed sequentially.

Compared to the lifecycle phase, the three sets of lifecycles are independent of each other, and users can simply invoke a phase of the clean lifecycle or simply invoke a phase of the default lifecycle without any impact on other lifecycles.

2. Clean life cycle

The clean lifecycle is aimed at cleaning up the project, which consists of three phases:

1)Pre-clean to perform some cleanup work before it is done.

2 Clean cleans up the files generated by the previous build.

3)Post-clean perform some cleanup work that needs to be done.

3. Default life cycle

The default lifecycle defines all the steps that are required to perform a real artifact, which is the core part of the lifecycle, and contains the following phases:

1) Validate verify that the project is correct and that all required related resources are available

2) initialization construction of initialize

3) generate-sources

4) process-sources Processing source code

5) Generate-resources

6) Process-resources Process the project master resource file. Copy the contents of the Src/main/resources directory to the main classpath directory of the project output after work such as variable substitution.

7) Compile compile the project's main source code

8) process-classes

9) Generate-test-sources

Process-test-sources Processing Project Test resource file

One) generate-test-resources

Process-test-resources the resource file to process the test

Test-compile the test code for compiling the project

) process-test-classes

Test runs the test using the Unit test framework, and the testing code is not packaged or deployed

Prepare-package Ready to pack

Package accepts compiled code, packaged in a published format

) pre-integration-test

) integration-test

) Post Integration-test

) Verify

Install installs the package to the MAVEN local repository for use by local other MAVEN projects

Deploy the final package to a remote repository for use by other developers and MAVEN projects

4. Site Life cycle

The purpose of the site lifecycle is to build and publish the project site, and Maven can automatically generate a friendly site based on the information contained in the POM to facilitate communication and release of project information by the team. The lifecycle consists of the following phases:

1) pre-site perform some work that needs to be done before building the project site

2 site to build the Project Web document

3) Post-site perform some work that needs to be done after building the project site

4) Site-deploy publishes the generated project site to the server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.