Mark W
Mark W

Reputation: 5964

'mvn clean install': why does 'clean' run after 'install'?

If I run mvn clean install why does maven do the clean after the install?

The reason I ask is because I want to grab the generated EAR from the workspace and not the repo location after jenkins has called maven

Here's a section of the console output:

[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] 

Upvotes: 0

Views: 2675

Answers (1)

Anton Koscejev
Anton Koscejev

Reputation: 4847

When you run mvn clean install , it executes for each module, that is parent project and each submodule. Your log excerpt shows that it finished the install part for myProject.EAR project, and started working on the myProject, starting with clean as it prints (default-clean) @ myProject .

This is also evident from the paths in the log: The first module is located at /var/lib/jenkins/jobs/MP/workspace/myProject.EAR, while the second module is located at /var/lib/jenkins/jobs/MP/workspace/myProject .

Perhaps you could describe what you're doing and what doesn't work, but this part of the build seems to work as designed .

Upvotes: 2

Related Questions