mkdir -p helloserver/src; cd helloserver;
cat << EOF > src/HelloServer.groovy
vertx.createHttpServer().requestHandler({ req ->
req.response().putHeader("content-type", "text/html").
end("<html><body><h3>Hello from vert.X</h3></body></html>")
}).listen(8080)
EOF
cat << EOF > build.gradle
task mytask(type:Exec) {
inputs.files 'src'
//commandLine 'vertx', 'run', 'src/HelloServer.groovy"' # this not work
commandLine 'cat', 'src/HelloServer.groovy'
ext.output = {
return standardOutput.toString()
}
}
EOF
gradle -t mytask
Any file in folder 'src' changes, gradle will rerun 'mytask'. However, the command after 'commandLine' parameter can't be a service.
Ref: Continuous build