Sign up ×

I'm trying to write a Windows batch script, that given a path, will search recursively through that directory looking for maven projects. When it has found all the maven project paths, I want to run some of the maven plugins against each of these projects.

My problems is this, I'm not sure of the best way to find the projects roots since I use inheritance in my poms e.g.




Really I only want to find the path of /project in this instance and not of module1/2 e.g. where the parent pom is. At the moment I am searching for all pom.xml and working out which is the parent by scanning for <packaging>pom</packaging> in the xml file.

This works, but I can't help feeling that there are better methods of finding maven projects/parent poms.

share|improve this question
you don't want to use powershell ? –  Kayasax Jan 31 '13 at 10:24

1 Answer 1

up vote 1 down vote accepted

Your strategy sounds good, but perhaps I can simplify your implementation. (tough for me to tell since you didn't show how you are currently doing it).

You could simply process the results of a recursive FINDSTR search with a FOR /F loop.

  'findstr /mls "<packaging>pom</packaging>" "yourRootPath\pom.xml"'
) do echo %%~dpF
share|improve this answer

Your Answer


