[英]Continuously building and running Gradle application using application plugin
I have a Spring boot Gradle app with application plugin: 我有一个带有应用程序插件的Spring boot Gradle应用程序:
plugins {
id 'com.moowork.node' version '1.2.0'
id 'java'
id 'eclipse'
//a plugin to run the gradle application using command line: ./gradlew run
id 'application'
id 'org.springframework.boot' version '2.0.4.RELEASE'
}
mainClassName = 'com.boot.MyProject.MyApplication'
I run this project using ./gradlew -t run
. 我使用./gradlew -t run
运行该项目。 I'd like gradle to watch my project files and rebuilds the project and runs it if there is any change in its files. 我希望gradle观看我的项目文件,如果文件中有任何更改,请重建项目并运行它。 But it seems that merely using -t
doesn't help. 但是似乎仅使用-t
并没有帮助。
Any idea how I should make this work? 知道我应该如何进行这项工作吗?
According to this answer , it can't work if the app is still running. 根据此答案 ,如果应用程序仍在运行,它将无法正常工作。 Gradle will detect the change but as the task ( run
) is not finished successfully, the restart won't be triggered. Gradle将检测到更改,但是由于任务( run
)未成功完成,因此不会触发重新启动。
It will only work well if the run
task is finished before the change happens. 只有在更改发生之前完成run
任务,它才能正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.