Maven使用时,对部分常用指令的区分不是很清楚,如compileinstall deploy的具体区别,故摘录其官方文档内容,并附注个人理解如下:
Maven Phases
·validate: validate the project is correct and all necessaryinformation is available
·从配置文件、目录结构等方面校验项目必要信息的正确性,不编译
·compile: compile the source code of the project
·编译源码,java--> class
·test: test the compiled source code using a suitableunit testing framework. These tests should not require the code be packaged ordeployed
·针对项目中使用unit test的测试套件执行测试,这里只有不依赖于发布的单元测试被执行
·package: take the compiled code and package it in itsdistributable format, such as a JAR.
·打包,将编译后的代码打包成发布格式,比如Jar,值得注意的是,这里只是将打包文件放到当前项目的target下,其他项目还无法引用
·integration-test: process and deploy the package if necessary intoan environment where integration tests can be run
·大概是打包后的测试,没用过
·verify: run any checks to verify the package is valid andmeets 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 otherdevelopers and projects.
·与install类似,发布最终版本到远端仓库,顾名思义:发布
·clean: cleans up artifacts created by prior builds
·site: generates site documentation for this project
源文档
总结下来:
·compile是源码到字节码的编译;
·package是打包到项目下;
·install和deploy分别是发布到本地仓库和远端仓库。