I have server application that I run using gradle bootRun .
I also have script runUpdate.sh that I need to run from command line of terminal after application is started.
I created gradle task that run this script:
task runUpdate(type: Exec) {
commandLine './runUpdate.sh'
}
Now I want to run this script from bootRun automatically. With no need to execute additional step manually. How can I do it?
I'm using this the command shouldRunAfter to define that my task run before the bootRun
task runUpdate(type: Exec) {
commandLine './runUpdate.sh'
}
// This will set te bootRun to wait your task run first
bootRun.configure {
shouldRunAfter runUpdate
}
https://docs.gradle.org/current/userguide/more_about_tasks.html
you can use gradle dependsOn here is a sample code
bootRun{
dependsOn runUpdate
}
task runUpdate(type: Exec) {
commandLine './runUpdate.sh'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.