This makes me happy

groovy -e ‘def printout = { it.consumeProcessOutput(System.out, System.err); it.waitFor() }; new File(/./).eachDirMatch ({ new File(it, /pom.xml/).exists() }) { printout(“mvn -f $it/pom.xml clean”.execute()) }’

Which can be simplified from Groovy 1.5 to Groovy 1.6.5 speak:
groovy -e ‘new File(/./).eachDirMatch ({ new File(it, /pom.xml/).exists() }) {“mvn -f $it/pom.xml clean”.execute(). waitForProcessOutput(System.out,System.err)}’

which only fits in a tweet if you don’t care for errors when a directory isn’t a maven project:
groovy -e ‘new File(/./).eachDir {“mvn -f $it/pom.xml clean”.execute(). waitForProcessOutput(System.out,System.err)}’

For those of you looking puzzled, it’s a Groovy way to clean a bunch of Maven project subfolders you plan to add into Subversion. It’ll work for ant too just by changing “mvn” to “ant” and changing “pom.xml” to “build.xml” in case you have a bunch of Ant projects that need to be added into svn.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s