我有使用gradle bootRun运行的服务器应用程序。
我还有脚本runUpdate.sh,我需要在应用程序启动后从终端命令行运行它。
我创建了运行此脚本的 gradle 任务:
task runUpdate(type: Exec) {
commandLine './runUpdate.sh'
}
现在我想从 bootRun 自动运行这个脚本。无需手动执行额外的步骤。我该怎么做?
最佳答案
我使用命令 shouldRunAfter 来定义我的任务在 bootRun 之前运行
task runUpdate(type: Exec) {
commandLine './runUpdate.sh'
}
// This will set te bootRun to wait your task run first
bootRun.configure {
shouldRunAfter runUpdate
}
关于java - 如何在 gradle bootRun 结束时运行附加任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47404856/