Friday, July 22, 2022

[SOLVED] Find pom in subdirectories and execute mvn clean

Issue

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.


Solution

Something like this should probably work:

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



Answered By - Mzzl
Answer Checked By - Mary Flores (WPSolving Volunteer)