I am trying to execute a command with gradle with the below task:
task stopServer(dependsOn: war, type: Exec) << {
commandLine 'pkill -9 tomcat'
}
When I run it I get the following error:
* What went wrong:
Execution failed for task ':stopServer'.
> execCommand == null!
And when my task is like this:
task stopServer(dependsOn: war) << {
exec {
commandLine 'pkill -9 tomcat'
}
}
I get this error:
* What went wrong:
Execution failed for task ':stopServer'.
> A problem occurred starting process 'command 'pkill -9 tomcat''
Can you tell me where I am going wrong in each of these approaches?
If neither of above are right way of executing then please specify the way of doing it probably with an example.