new File('.').eachFile{
//do something
}
And of course I was aware that on Windows you have to use a "cmd /c" prior to your executable. So my final was going to look like this:
new File('.').eachFile{
groupId = it.name.substring(0, it.name.size() - 4)
"cmd /c mvn install:install-file -DgroupId=blahzy.blah-DartifactId=${groupId} -Dversion=9.9.9 -Dpackaging=jar -Dfile=${it.name}".execute().text
}
Seems appropriately short and succinct for my groovy instincts to feel okay with it. Only problem is that it didn't work. When I would run it the console would freeze and I had no idea what was going on. After reading through some of the groovy documentation online I found out that if the output is too much the Windows process will just freeze. Luckily there was a documented "hack" to solve the issue. My final script:
new File('.').eachFile{
groupId = it.name.substring(0, it.name.size() - 4)
thisCommand = "cmd /c mvn install:install-file -DgroupId=blahzy.blah-DartifactId=${groupId} -Dversion=9.9.9 -Dpackaging=jar -Dfile=${it.name}"
proc = thisCommand.execute()
proc.consumeProcessOutput()
}
So I don't get any of the output but it worked so who am I to complain.