Maven build lifecycle
Clean Lifecycle
运行mvn clean
执行clean生命周期,包含三个生命周期阶段:
pre-clean
clean
post-clean
clean:clean
会删除一次构建后的输出,默认删除_${basedir}/target/_目录(如果你没有自定义输出目录)。
执行clean
阶段的时候,maven可以执行任何绑定到pre-clean
阶段的_goal_(目标)。
例如:你想在pre-clean
阶段时触发antrun:run
_goal_来输出一个通知,或者想在构陷目录删除时,打包一下。
**Triggering a Goal on pre-clean. **
<project>
...
<build>
<plugins>... <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>file-exists</id>
<phase>pre-clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>hello world</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我们还可以自定义clean插件的删除目录(即除了默认的目录,再删除别的目录)。可以配置fileSet
配置项,该配置支持ant的通配符。
**Customizing Behavior of the Clean Plugin. **
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>target-other</directory>
<includes>
<include>*.class</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
Default Lifecycle
maven的默认生命周期,有如下阶段:
Lifecycle Phase | Description |
---|---|
validate | 验证项目的正确性和完成该构建的必要信息 |
generate-sources | 生成包含在编译之中的源代码 |
process-sources | 处理源码,如过滤某些值 |
generate-resources | 生成资源文件,这些文件会包含到打包中 |
process-resources | 将资源文件复制到目标目录,并处理,准备打包 |
compile | 编译源码 |
process-classes | 对生成的类文件后处理,如字节码增强 |
generate-test-sources | 生成测试代码 |
process-test-sources | 处理测试代码 |
generate-test-resources | 生成测试用的资源文件 |
process-test-resources | 复制资源文件到测试目录 |
test-compile | 编译测试代码 |
test | 测试 |
prepare-package | 打包前的准备工作 |
package | 打包,如JAR,WAR等 |
pre-integration-test | 集成测试准备 |
integration-test | 集成测试 |
post-integration-test | 集成测试后的工作 |
verify | 检查验证生成的java包 |
install | 安装到本地仓库 |
deploy | 部署到目标地址 |
Site Lifecycle
暂时用不到,不整理
Maven build lifecycle的更多相关文章
- Maven Build Life Cycle--reference
What is Build Lifecycle? A Build Lifecycle is a well defined sequence of phases which define the ord ...
- maven:log4j:WARN No appenders could be found for logger (loggerInfo).或者maven build error:org.apache.maven.lifecycle.LifecycleExecutionExceptio
maven在build构建时,加载资源文件时需要配置资源文件插件: 1,在pom.xml文件中加入 <build> <finalName>${project.build.tar ...
- Introduction to the Build Lifecycle
Introduction to the Build Lifecycle Table Of Contents Build Lifecycle Basics Setting Up Your Project ...
- 在eclipse如何删除无效的maven build
在Eclipse的maven项目中,点击一次“maven build...”明明没有配置,它也就会产生一个maven build,那么如何删除这些无效的配置呢?
- Maven Build Profiles--reference
What is Build Profile? A Build profile is a set of configuration values which can be used to set or ...
- No compiler is provided in this environment. --Maven build失败
今天,maven build 失败了, 遇到下面的问题 经过查找,通过这个大佬的blog( https://blog.csdn.net/lslk9898/article/details/738367 ...
- Spring Boot-右键maven build成功但是直接运行main方法出错的解决方案
1.代码就一个Controller,从官网复制过来的,如下 package com.springboot.controller; import org.springframework.boot.Spr ...
- 转:eclipse maven build、maven install 等区别
原文地址:eclipse maven build.maven install 等区别
- maven build的常用生命周期
常用的maven build goals: validate - validate the project is correct and all necessary information is av ...
随机推荐
- Uncaught RangeError: Maximum call stack size exceeded 调试日记
异常处理汇总-前端系列 http://www.cnblogs.com/dunitian/p/4523015.html 开发道路上不是解决问题最重要,而是解决问题的过程,这个过程我们称之为~~~调试 记 ...
- PostCSS深入学习: PostCSS和Sass、Stylus或LESS一起使用
如果你喜欢使用PostCSS,但又不想抛弃你最喜欢的预处理器.不用担心,你不需要作出二选一的选择,你可以把PostCSS和预处理器(Sass.Stylus或LESS)结合起来使用. 有几个PostCS ...
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(5)-EF增删改查
系列目录 前言 为了符合后面更新后的重构系统,文章于2016-11-1日重写 回顾上一节的解决方案,我们看出了解决方案中类库的关系 这里要说明一点MVC!=三层 他们大约是这样的一种关系 代码实现 上 ...
- 如何在删除ibdata1和ib_logfile的情况下恢复MySQL数据库
昨天,有个朋友对公司内部使用的一个MySQL实例开启binlog,但是在启动的过程中失败了(他也没提,为何会失败),在启动失败后,他删除了ibdata1和ib_logfile,后来,能正常启动了,但所 ...
- Linux内核启动过程概述
版权声明:本文原创,转载需声明作者ID和原文链接地址. Hi!大家好,我是CrazyCatJack.今天给大家带来的是Linux内核启动过程概述.希望能够帮助大家更好的理解Linux内核的启动,并且创 ...
- Web安全相关(二):跨站请求伪造(CSRF/XSRF)
简介 CSRF(Cross-site request forgery跨站请求伪造,也被称为“One Click Attack”或者Session Riding,通常缩写为CSRF或者XSRF,是一种对 ...
- How to implement equals() and hashCode() methods in Java[reproduced]
Part I:equals() (javadoc) must define an equivalence relation (it must be reflexive, symmetric, and ...
- 一个简单的webservice的demo(下)winform异步调用webservice
绕了一大圈,又开始接触winform的项目来了,虽然很小吧.写一个winform的异步调用webservice的demo,还是简单的. 一个简单的Webservice的demo,简单模拟服务 一个简单 ...
- [C1] 仿 Excel 实现(C1FlexGrid)
一 分析阶段 根据 Excel 表格区域的划分,如下图,基本上以4行*3列的框架搭建: 第一行为列头区域 ==> C1FlexGrid.ColumnHeaders 第二行为单元格区域 ...
- Razor 语法初级使用,不断更新此文章
有兴趣的可以看看菜鸟教程的 http://www.runoob.com/aspnet/razor-cs-loops.html 1.ViewData展示登陆的Session信息 Controller ...