Maven生命周期阶段详解
3大生命周期蕴含着小小的阶段,我们按顺序看一下
clean周期:
pre-clean:准备清理
clean:真正的清理工作
post-clean:执行清理后的一些后续工作
default周期:
validate:验证
initialize:初始化配置
generate-sources:生成源代码编译目录
process-sources:处理项目主资源文件,复制资源文件到outputclasspath
generate-resources:生成资源目录
process-resources:处理资源文件
complie:编译源代码
process-classes:处理编译后文件
generate-test-sources:生成测试目录
process-test-sources:处理项目测试资源文件,复制测试资源文件到outputclasspath
generate-test-resources:生成测试资源文件
process-test-resources:处理测试资源文件
test-compile:编译测试代码
process-test-classes:处理测试代码
test:单元测试运行测试代码
prepare-package:打包前的准备
package:将编译好的代码打包成为jar或者war或者ear等等
pre-integration-test:准备整体测试
integration-test:整体测试
post-integration-test:为整体测试收尾
verify:验证
install:安装到本地Maven库
deploy:将最终包部署到远程Maven仓库
site周期:
pre-site:准备生成站点
site:生成站点及文档
post-site:站点收尾
生命周期阶段 | 插件目标 |
process-resources | maven-resources-plugin:resources |
compile | maven-compiler-pugin:compile |
process-test-resources | maven-resources-plugin:testResources |
test-compile | maven-compiler-plugin:testCompile |
test | maven-surefire-plugin:testCompile |
package | maven-jar-plugin:jar |
install | maven-install-plugin:install |
deploy | maven-deploy-plugin:deploy |
<groupId>com.alibaba.maven.plugins</groupId>
<artifactId>maven-autoconf-plugin</artifactId>
<version>${maven-autoconf-plugin.version}</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>config</goal>
</goals>
</execution>
</executions>
</plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>