9
Regarding Q2: while groovy itself doesn't provide any way to be notified on file changes, Java 7, which can be used with groovy, does.
In particular, if you want to watch for file changes on a file foo in the current directory, you can do something like this:
import java.nio.file.*
FileSystems.default.getPath(".") // dot for current directory
def watchKey = p.register(FileSystems.default.newWatchService(),
StandardWatchEventKinds.ENTRY_MODIFY)
def events = watchKey.pollEvents()
events.findAll{it.context().fileName == 'foo'}.each { event ->
println "foo was changed"
}