Yes, this is possible. The WAR process triggers an event just before the WAR file is created that you can use to do what you want. Create a file scripts/_Events.groovy in your project and add the following code to it:
Code:
eventCreateWarStart = { name, stagingDir ->
// Remove the controllers we don't want in the WAR
new File(stagingDir, "WEB-INF/classes").eachFileRecurse { f ->
if (f.name?.startsWith("MyController")) {
f.delete()
}
}
}
Whatever is left in the staging directory once you've finished gets packaged into the WAR.
Hope that helps.