Skip to content

fix: Prevent stale JAR cache in Reflector under Maven daemon (mvnd) (#23863) (CP: 24.10)#23986

Merged
caalador merged 1 commit into24.10from
cherry/cherrypick-23863-to-24.10
Mar 26, 2026
Merged

fix: Prevent stale JAR cache in Reflector under Maven daemon (mvnd) (#23863) (CP: 24.10)#23986
caalador merged 1 commit into24.10from
cherry/cherrypick-23863-to-24.10

Conversation

@mcollovati
Copy link
Copy Markdown
Collaborator

Mirror the Gradle daemon fix (33fa374) in the Maven plugin's Reflector and ReflectorClassLoader/CombinedClassLoader:

  • Extract ReflectionsClassFinder.disableJarCaching() as a public utility so both plugins can reuse it.
  • Wrap jar: URLs in ReflectorClassLoader.getResource() and getResources() (flow-maven-plugin) and CombinedClassLoader (flow-dev-bundle-plugin) with useCaches(false) to prevent stale JarFileFactory entries across daemon builds.
  • Make Reflector implement Closeable with a close() method that releases the URLClassLoader file handles, and register a Cleaner action for best-effort GC cleanup of abandoned instances.
  • Close the temporary Reflector in FlowModeAbstractMojo.isHillaAvailable(MavenProject) via try-with-resources.

Releated to #15458

…#23863)

Mirror the Gradle daemon fix (33fa374) in the Maven plugin's
`Reflector` and `ReflectorClassLoader`/`CombinedClassLoader`:

- Extract `ReflectionsClassFinder.disableJarCaching()` as a public
  utility so both plugins can reuse it.
- Wrap `jar:` URLs in `ReflectorClassLoader.getResource()` and
  `getResources()` (flow-maven-plugin) and `CombinedClassLoader`
  (flow-dev-bundle-plugin) with `useCaches(false)` to prevent stale
  `JarFileFactory` entries across daemon builds.
- Make `Reflector` implement `Closeable` with a `close()` method that
  releases the `URLClassLoader` file handles, and register a
  `Cleaner` action for best-effort GC cleanup of abandoned instances.
- Close the temporary `Reflector` in
  `FlowModeAbstractMojo.isHillaAvailable(MavenProject)` via
  try-with-resources.

Releated to #15458
@github-actions
Copy link
Copy Markdown

Test Results

1 287 files  ± 0  1 287 suites  ±0   1h 16m 34s ⏱️ -53s
8 830 tests + 2  8 767 ✅ + 2  63 💤 ±0  0 ❌ ±0 
9 117 runs   - 18  9 048 ✅  - 17  69 💤  - 1  0 ❌ ±0 

Results for commit e244f2a. ± Comparison against base commit 7470a42.

@sonarqubecloud
Copy link
Copy Markdown

@caalador caalador merged commit 411fbea into 24.10 Mar 26, 2026
65 of 67 checks passed
@caalador caalador deleted the cherry/cherrypick-23863-to-24.10 branch March 26, 2026 05:10
vaadin-bot pushed a commit that referenced this pull request Mar 26, 2026
…#23863) (#23986)

Mirror the Gradle daemon fix (33fa374) in the Maven plugin's
`Reflector` and `ReflectorClassLoader`/`CombinedClassLoader`:

- Extract `ReflectionsClassFinder.disableJarCaching()` as a public
  utility so both plugins can reuse it.
- Wrap `jar:` URLs in `ReflectorClassLoader.getResource()` and
  `getResources()` (flow-maven-plugin) and `CombinedClassLoader`
  (flow-dev-bundle-plugin) with `useCaches(false)` to prevent stale
  `JarFileFactory` entries across daemon builds.
- Make `Reflector` implement `Closeable` with a `close()` method that
  releases the `URLClassLoader` file handles, and register a
  `Cleaner` action for best-effort GC cleanup of abandoned instances.
- Close the temporary `Reflector` in
  `FlowModeAbstractMojo.isHillaAvailable(MavenProject)` via
  try-with-resources.

Releated to #15458
vaadin-bot added a commit that referenced this pull request Mar 26, 2026
…#23863) (#23986) (#24011)

Mirror the Gradle daemon fix (33fa374) in the Maven plugin's
`Reflector` and `ReflectorClassLoader`/`CombinedClassLoader`:

- Extract `ReflectionsClassFinder.disableJarCaching()` as a public
  utility so both plugins can reuse it.
- Wrap `jar:` URLs in `ReflectorClassLoader.getResource()` and
  `getResources()` (flow-maven-plugin) and `CombinedClassLoader`
  (flow-dev-bundle-plugin) with `useCaches(false)` to prevent stale
  `JarFileFactory` entries across daemon builds.
- Make `Reflector` implement `Closeable` with a `close()` method that
  releases the `URLClassLoader` file handles, and register a
  `Cleaner` action for best-effort GC cleanup of abandoned instances.
- Close the temporary `Reflector` in
  `FlowModeAbstractMojo.isHillaAvailable(MavenProject)` via
  try-with-resources.

Releated to #15458

Co-authored-by: Marco Collovati <marco@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants