“mvn clean install”:为什么“安装”后“干净”运行?

时间:2016-07-08 14:22:50

标签: jenkins maven-3 maven-install-plugin maven-clean-plugin

如果我跑 mvn clean install为什么maven在安装后会干净?

我问的原因是因为我想在jenkins调用maven之后从工作区获取生成的EAR而不是repo位置

以下是控制台输出的一部分:

[INFO] --- maven-install-plugin:2.4:install (default-install) @ myProject.EAR ---
[INFO] Installing target/myProject.EAR-1.0.0.ear to /var/lib/jenkins/.m2/repository/uk/co/mycompany/myProject.EAR/1.0.0/myProject.EAR-1.0.0.ear
[INFO] Installing /var/lib/jenkins/jobs/MP/workspace/myProject.EAR/pom.xml to /var/lib/jenkins/.m2/repository/uk/co/mycompany/myProject.EAR/1.0.0/myProject.EAR-1.0.0.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject 20.5.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ myProject ---
[INFO] Deleting /var/lib/jenkins/jobs/MP/workspace/myProject/target
[INFO] 

1 个答案:

答案 0 :(得分:2)

当你运行mvn clean install时,它会为每个模块执行,即父项目和每个子模块。您的日志摘录显示它已完成install项目的myProject.EAR部分,并开始处理myProject,从clean开始打印(default-clean) @ myProject

从日志中的路径也可以看出这一点:第一个模块位于/var/lib/jenkins/jobs/MP/workspace/myProject.EAR,而第二个模块位于/var/lib/jenkins/jobs/MP/workspace/myProject

也许你可以描述你正在做什么和什么不行,但这部分版本似乎按设计工作。