{
  "id": 21424867,
  "title": "Gradle Under the Hood: Hybrid JPMS Process Isolation & Dynamic Module Reflection",
  "url": "https://urgent.news/2026/11/23/gradle-under-the-hood-hybrid-jpms-process-isolation-dynamic-module",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-23T16:30:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yannickebongue/gradle-under-the-hood-hybrid-jpms-process-isolation-dynamic-module-reflection-4aac"
  },
  "original_language": "en",
  "account": "In Part 5 of the Gradle Under the Hood series, we tackle the challenge of running build-time JPA tooling against modular Java applications without weakening module encapsulation. The Java Platform Module System (JPMS) provides strong encapsulation, but standard Gradle workers on a flat classpath hit a wall when encountering deep reflection used by persistence tools like Hibernate. To address this, we engineered JPMSWorkerSupport, a hybrid execution router that inspects the target source set's compiled output directory and chooses the optimal Gradle WorkerExecutor isolation strategy based on whether module-info.class is present. For modular projects, JPMSWorkerSupport automatically switches to hermetic OS-level processIsolation, while non-modular projects execute in-process using fast classLoaderIsolation. Dynamic ModuleDescriptor inspection reads the compiled module-info.class binary directly using Java's ModuleDescriptor API to generate the exact --add-opens flags for the forked worker JVM, ensuring build-time tools get temporary, scoped reflective access without compromising production module descriptors. Additionally, we exposed custom settings like Hibernate default schema and dialect in the worker's SPI factory initialization, allowing for fine-tuned provider behavior. This hybrid execution approach removes friction for enterprise persistence projects adopting JPMS, enabling clean production descriptors, zero overhead for legacy modules, and full vendor control over custom settings.",
  "summary": "Over the first four articles of our Gradle Under the Hood series, we explored source-driven incremental tracking, network-immune classloader harvesting, compile-only dependency isolation, and our federated plugin architecture. Today, in Part 5 , we tackle one of the biggest friction points in modern enterprise Java builds: How do you run build-time JPA tooling—like bytecode enhancement, schema…",
  "key_points": [
    "JPMSWorkerSupport hybrid execution router inspects compiled output for optimal isolation strategy",
    "Dynamic ModuleDescriptor inspection generates precise --add-opens flags for forked worker JVM"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}