Skip to content

[3.1.4] Changing/reloading watched resources not triggering plugin's onChange. #9848

@budjb

Description

@budjb

I've got a plugin that defines 2 custom artefacts, and the plugin watches those files for changes and contains an onChange method. I've noticed that while running locally (gradle bootRun and grails run-app), changing and reloading those artefacts does not trigger the onChange method in the plugin. I have confirmed that the onChange method signature is correct.

I've poured through the source looking for clues, and found a couple of things in coordination with the IntelliJ debugger. The GrailsApp class contains a loop looking for changed and new files. This loop does execute when a local file is changed. The only time plugins are notified to fire the onChange method, however, is when the file is new source. Thus, files that have only been changed do not trigger a notification to run the onChange method when they have already existed.

I see other code in DefaultGrailsPlugin that does the actual work of calling a plugin's onChange method, but most of those methods are never actually referenced anywhere in the project.

It seems like the watcher loop in GrailsApp is the place to notify of changes, but I don't understand why there's a check that only triggers an onchange notification only for new files.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions