Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find pom in subdirectories and execute mvn clean

Tags:

What is the command for finding all subdirectories which contain pom.xml file and then execute:

mvn clean  

operation in that subdirectory?

I have workspaces that contain multiple maven projects and I want to clean all of them.

like image 965
Damian0o Avatar asked Apr 09 '13 07:04

Damian0o


People also ask

What does mvn clean command do?

Thus, when mvn clean command executes, Maven deletes the build directory. We can customize this behavior by mentioning goals in any of the above phases of clean life cycle.

What is mvn clean test command?

mvn clean: Cleans the project and removes all files generated by the previous build. mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code. mvn test: Runs tests for the project. mvn package: Creates JAR or WAR file for the project to convert it into a distributable format.


1 Answers

Something like this should probably work:

find . -name "pom.xml" -exec mvn clean -f '{}' ;

like image 173
Mzzl Avatar answered Nov 07 '22 01:11

Mzzl