maven 之 build lifecycle
2015-06-26 16:38
405 查看
在使用maven 构建项目时,时刻离不开命令,以便对项目做一些操作,这些操作都是来源于将build 过程细化。
详细lifecycle不再一一列出,可参见maven 官网之 build lifecycle篇:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings
官网介绍中,我比较感兴趣的:
与上图相对应,看看右侧的goal 怎么定义或者说 从何而来?举例说明之
在build 项目时,pom.xml中的<build>...</build>中有些插件定义,如下:
<project>
<build>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
</project>
大体意思是,这个名为maven-clean-plugin的插件的目标是clean,在clean阶段时,开始执行。
取插件名字中间部分:clean,goal 为clean,
将goal 与 phase 对应上,即为:
再写个例子,以便方便理解:
可以将phase绑定到多个goal上,goal的顺序随着它绑定的phase(阶段) 执行。
引用stackoverflow:
链接地址:http://stackoverflow.com/questions/16205778/what-is-the-difference-relation-between-maven-goals-and-phases
If you specify a goal when you execute Maven then it will still run all phases up to the phase for that goal. In other words, if you specify the jar goal it will run all phases up to the package phase (and all goals in those phases), and then it will run the jar goal.
详细lifecycle不再一一列出,可参见maven 官网之 build lifecycle篇:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings
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. integration-test - process and deploy the package if necessary into an environment where integration tests can be run verify - run any checks to verify the package is valid and meets quality criteria install - install the package into the local repository, for use as a dependency in other projects locally deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
官网介绍中,我比较感兴趣的:
与上图相对应,看看右侧的goal 怎么定义或者说 从何而来?举例说明之
在build 项目时,pom.xml中的<build>...</build>中有些插件定义,如下:
<project>
<build>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
</project>
大体意思是,这个名为maven-clean-plugin的插件的目标是clean,在clean阶段时,开始执行。
取插件名字中间部分:clean,goal 为clean,
将goal 与 phase 对应上,即为:
phase | goal(<plugin>:<goal>) |
---|---|
clean | clean:clean |
可以将phase绑定到多个goal上,goal的顺序随着它绑定的phase(阶段) 执行。
引用stackoverflow:
链接地址:http://stackoverflow.com/questions/16205778/what-is-the-difference-relation-between-maven-goals-and-phases
If you specify a goal when you execute Maven then it will still run all phases up to the phase for that goal. In other words, if you specify the jar goal it will run all phases up to the package phase (and all goals in those phases), and then it will run the jar goal.
相关文章推荐
- VMware Workstation 5.5.3 Build 34685 汉化补丁
- IncrediMail Xe Premium v5.6.5 Build 3054 多国语言版 下载
- 宽带优化的最强武器cFosSpeed V3.13 Build 1200 多语言完美破解版(保证可下载)
- ACDSee v9.0 Build 115简体中文安装版 完美破解 下载
- PDF编辑工具 Foxit PDF Editor 1.5 Build 2911 下载
- Windows优化大师 V7.72 Build 7.0429 完美破解特别版 下载
- 系统备份必备软件之一键GHOST v8.3 Build 070101 全版下载
- Windows优化大师 V7.75 Build 7.806 免注册破解版 提供下载
- ACDSee v9.0 Build 115简体中文安装版 完美破解 下载
- AVG Anti-Virus 7.5 Build 476a1043
- O&O SafeErase v3.0 Build 1064 下载
- 英语听写专家 2.1 Build 0086 注册码
- 一键GHOST V8.3 Build 060425 硬盘版一键ghost使用方法说明[图文详细教程]
- 使用maven+eclipse搭建struts2开发环境
- maven中下载jar包源码和javadoc的命令介绍
- Maven学习笔记
- 利用google closure依赖工具配置
- Docker+Jenkins+GIT+Tomcat实战持续化集成
- jenkins自动发布java代码