一、如下图大家知道各项的含义吗?
二、下面一一介绍
- Maven clean 将以前编译得到的旧的 class 字节码文件删除,即删除target文件夹下的内容
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ysx --- [INFO] Deleting /Users/haidiyixiaoyu/eclipse-workspace/ysx/target [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.489 s [INFO] Finished at: 2020-01-25T17:55:12+08:00 [INFO] ------------------------------------------------------------------------
- Maven generate-sources 开发环境与代码分离,很少使用
- Maven install 对项目进行编译并将项目生成 jar 包放在本地仓库中,以便别的模块调用
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ysx ---
[INFO] Surefire report directory: /Users/haidiyixiaoyu/eclipse-workspace/ysx/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.ysx.cn.ysx.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ysx ---
[INFO] Building jar: /Users/haidiyixiaoyu/eclipse-workspace/ysx/target/ysx-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ysx ---
[INFO] Installing /Users/haidiyixiaoyu/eclipse-workspace/ysx/target/ysx-0.0.1-SNAPSHOT.jar to /Users/haidiyixiaoyu/.m2/repository/com/ysx/cn/ysx/0.0.1-SNAPSHOT/ysx-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/haidiyixiaoyu/eclipse-workspace/ysx/pom.xml to /Users/haidiyixiaoyu/.m2/repository/com/ysx/cn/ysx/0.0.1-SNAPSHOT/ysx-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.291 s
[INFO] Finished at: 2020-01-25T18:14:08+08:00
[INFO] ------------------------------------------------------------------------
- Maven test 对项目进行编译并生成测试报告
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ysx --- [INFO] Surefire report directory: /Users/haidiyixiaoyu/eclipse-workspace/ysx/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.ysx.cn.ysx.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.921 s [INFO] Finished at: 2020-01-25T18:18:22+08:00 [INFO] ------------------------------------------------------------------------
- Maven build... Eclipse的Maven插件,可以预先设置要执行的Maven命令
- Maven build 执行已经定义好的Maven命令
三、其他Maven命令
1.package 编译代码并测试打包,不发布到本地仓库
------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.ysx.cn.ysx.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ysx --- [INFO] Building jar: /Users/haidiyixiaoyu/eclipse-workspace/ysx/target/ysx-0.0.1-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.535 s [INFO] Finished at: 2020-01-26T11:48:38+08:00 [INFO] ------------------------------------------------------------------------
2.deploy 将项目发布到远程仓库