Introduction to the Build Lifecycle(Maven运行周期)

翻译自:Introduction to the Build Lifecycle

Table Of Contents

Build Lifecycle Basics
Setting Up Your Project to Use the Build Lifecycle
    Packaging
    Plugins
Lifecycle Reference
Built-in Lifecycle Bindings

大纲
基本概念
如何配置工程
打包
插件
详细内容
运行周期包含步骤

Build Lifecycle Basics

Maven is based around the central concept of a build lifecycle. What this means is that the process for building and distributing a particular artifact (project) is clearly defined.

For the person building a project, this means that it is only necessary to learn a small set of commands to build any Maven project, and the POM will ensure they get the results they desired.

There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's site documentation.

基本概念
Maven是围绕运行周期来工作的,这样做的意义就是要明确界定出项目的生产和部署等不同处理过程。
我们只需要了解其中几个简单的Maven命令就可以通过POM文件去构建需要的工程了。
运行周期包含了三个基本步骤:缺省(default)、清理(clean)和站点(site)。缺省步骤负责部署项目,清理步骤用于项目的清理过程,使用站点步骤可以产生项目的文档和一些后续任务。

A Build Lifecycle is Made Up of Phases
一个构建周期包含的阶段

Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle.
每个构建周期是包含了不同的构建步骤序列,序列中的每一个构建步骤就是生命周期中的一个过程。

For example, the default lifecycle comprises of the following phases (for a complete list of the lifecycle phases, refer to the Lifecycle Reference):

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

例如缺省模式就包含如下几个步骤(点击查看完整的构建步骤生命周期
确认-
编译 -
测试 -
打包 -
验证 -
安装 -
部署 -

These lifecycle phases (plus the other lifecycle phases not shown here) are executed sequentially to complete the default lifecycle. Given the lifecycle phases above, this means that when the default lifecycle is used, Maven will first validate the project, then will try to compile the sources, run those against the tests, package the binaries (e.g. jar), run integration tests against that package, verify the integration tests, install the verified package to the local repository, then deploy the installed package to a remote repository.

标签: none

添加新评论