Skip to content

Duplicate recompilation fixed for .class files#505

Open
sajeerzeji wants to merge 2 commits intoOpenLiberty:mainfrom
sajeerzeji:GH752-duplicate_processFileChanges_calls_for_java_source_files_in_devmode
Open

Duplicate recompilation fixed for .class files#505
sajeerzeji wants to merge 2 commits intoOpenLiberty:mainfrom
sajeerzeji:GH752-duplicate_processFileChanges_calls_for_java_source_files_in_devmode

Conversation

@sajeerzeji
Copy link
Copy Markdown

Fixes an issue mentioned in the comments of Maven:#752, where the issue was about the processFileChanges() was being called multiple times for the same .properties file when modifying in dev mode, but that is working correctly now, but I found an issue that is processFileChanges() is getting called twice for .class files when we change Java sources in dev mode.

When a .java file changes, the plugin queues it for compilation in the recompileJavaSources list. After a timeout, the plugin compiles the .java file into a .class file. Liberty then detects this .class file change and hot reloads the application.

The problem was that the .java file remained in the recompileJavaSources queue even after being compiled. This caused the plugin to compile the same .java file a second time, creating duplicate work and triggering unnecessary file change events.

The fix detects when Liberty has successfully hot reloaded by checking if the Application Update message count increased. If it has reloaded, we clear the recompileJavaSources list to prevent the plugin from compiling the same .java files again. This eliminates the duplicate compilation thus the processFileChanges() will be called only once.

@sajeerzeji sajeerzeji requested a review from venmanyarun April 6, 2026 07:55
@sajeerzeji sajeerzeji self-assigned this Apr 6, 2026
Copy link
Copy Markdown
Contributor

@venmanyarun venmanyarun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create PR's for ci.maven and ci.gradle with updated tests to make sure integration-tests are working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants