Hello!
Could clarify Jmix version do you use? Is WidgetsCompile task performed for each application run?
Since Jmix 1.2 added includePaths attribute to compileWidgets task configuration. It means that task will be performed only if code in the provided paths is changed.
Could you check the build.gradle file, there should be the following task configuration:
compileWidgets {
    dependsOn(processResources)
    generate "com.company.myapp.widgets.CustomWidgetSet"
    includePaths("**/io/jmix/**/widget/**", "**/com/company/myapp/widgets/**")
}
If no, please add this code. Due to this configuration, the subsequent builds won’t run the WidgetsCompile task.
Note, the second path should be changed according to your application package structure.