DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Rerun Gradle Tasks After File Changes


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



Published

Mar 31, 2017

Last Updated

Mar 31, 2017

Category

Tech

Tags

  • gradle 11
  • rerun 1
  • task 2

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor