<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yannick Ebongue</title>
    <description>The latest articles on DEV Community by Yannick Ebongue (@yannickebongue).</description>
    <link>https://dev.to/yannickebongue</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4160006%2Fd2f8a802-e917-4a7f-b447-50f269834ff3.png</url>
      <title>DEV Community: Yannick Ebongue</title>
      <link>https://dev.to/yannickebongue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yannickebongue"/>
    <language>en</language>
    <item>
      <title>Gradle Under the Hood: Hybrid JPMS Process Isolation &amp; Dynamic Module Reflection</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Mon, 23 Nov 2026 16:30:00 +0000</pubDate>
      <link>https://dev.to/yannickebongue/gradle-under-the-hood-hybrid-jpms-process-isolation-dynamic-module-reflection-4aac</link>
      <guid>https://dev.to/yannickebongue/gradle-under-the-hood-hybrid-jpms-process-isolation-dynamic-module-reflection-4aac</guid>
      <description>&lt;p&gt;Over the first four articles of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we explored source-driven incremental tracking, network-immune classloader harvesting, compile-only dependency isolation, and our federated plugin architecture.&lt;/p&gt;

&lt;p&gt;Today, in &lt;strong&gt;Part 5&lt;/strong&gt;, we tackle one of the biggest friction points in modern enterprise Java builds: &lt;strong&gt;How do you run build-time JPA tooling—like bytecode enhancement, schema validation, and query linting—against modular Java applications (&lt;code&gt;module-info.java&lt;/code&gt;) without forcing developers to weaken their module encapsulation?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s look at how we engineered &lt;strong&gt;JPersist v1.9.0&lt;/strong&gt; to support hybrid JPMS execution, dynamic &lt;code&gt;ModuleDescriptor&lt;/code&gt; reflection opens, and vendor-specific provider settings out of the box.&lt;/p&gt;

&lt;h3&gt;
  
  
  The JPMS Build-Time Tooling Wall
&lt;/h3&gt;

&lt;p&gt;The Java Platform Module System (JPMS) provides strong encapsulation and reliable configuration. However, build-time persistence tools—especially Hibernate—rely heavily on deep reflection (&lt;code&gt;Field.setAccessible(true)&lt;/code&gt;) to inspect entity classes, generate metamodels, and validate schemas.&lt;/p&gt;

&lt;p&gt;When a project introduces a &lt;code&gt;module-info.java&lt;/code&gt; descriptor, standard Gradle workers running on a flat classpath hit a wall:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Encapsulation Blockades:&lt;/strong&gt; Unless the user explicitly adds &lt;code&gt;opens com.example.domain to io.github.jpersist.tools.hibernate.orm;&lt;/code&gt; inside their production &lt;code&gt;module-info.java&lt;/code&gt;, Hibernate throws an &lt;code&gt;InaccessibleObjectException&lt;/code&gt; during schema validation or query linting. Forcing developers to pollute production module descriptors just to satisfy build-time linters is an anti-pattern.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Process Fork Overhead:&lt;/strong&gt; Running every project inside a forked JVM process (&lt;code&gt;processIsolation&lt;/code&gt;) guarantees modular boundaries, but adds unnecessary startup latency for traditional, non-modular classpath projects.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Solution: Hybrid Execution Isolation (&lt;code&gt;JPMSWorkerSupport&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;To get the best of both worlds, we designed &lt;strong&gt;&lt;code&gt;JPMSWorkerSupport&lt;/code&gt;&lt;/strong&gt;—a hybrid execution router that inspects the target source set's compiled output directory at task execution time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="nf"&gt;isModularProject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;File&lt;/span&gt; &lt;span class="n"&gt;classesDir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;classesDir&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;classesDir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"module-info.class"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on whether &lt;code&gt;module-info.class&lt;/code&gt; is present, JPersist dynamically chooses the optimal Gradle &lt;code&gt;WorkerExecutor&lt;/code&gt; isolation strategy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Non-Modular Projects (Classpath):&lt;/strong&gt; Executes in-process using fast &lt;code&gt;classLoaderIsolation&lt;/code&gt;, avoiding any JVM fork overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modular Projects (JPMS):&lt;/strong&gt; Switches automatically to hermetic OS-level &lt;strong&gt;&lt;code&gt;processIsolation&lt;/code&gt;&lt;/strong&gt;, placing the user's classes and dependencies onto &lt;code&gt;--module-path&lt;/code&gt; while keeping Gradle's worker action bridge files on the bootstrap classpath.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dynamic &lt;code&gt;ModuleDescriptor&lt;/code&gt; Inspection &amp;amp; &lt;code&gt;--add-opens&lt;/code&gt; Injection
&lt;/h3&gt;

&lt;p&gt;To prevent users from having to manually open their entity packages in &lt;code&gt;module-info.java&lt;/code&gt;, &lt;code&gt;JPMSWorkerSupport&lt;/code&gt; reads the compiled &lt;code&gt;module-info.class&lt;/code&gt; binary directly using Java's standard &lt;code&gt;java.lang.module.ModuleDescriptor&lt;/code&gt; API before spawning the worker JVM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;appendDynamicUserModuleOpens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;File&lt;/span&gt; &lt;span class="n"&gt;moduleInfoFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;jvmArgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readAllBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;moduleInfoFile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toPath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nc"&gt;ModuleDescriptor&lt;/span&gt; &lt;span class="n"&gt;descriptor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ModuleDescriptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ByteBuffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;moduleName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;descriptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;descriptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;packages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;each&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;pkg&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="n"&gt;jvmArgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'--add-opens'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;jvmArgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\${moduleName}/pkg={HIBERNATE_MODULES}"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;ignored&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Safe fallback if module-info.class cannot be parsed&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At runtime, JPersist automatically constructs the exact &lt;code&gt;--add-opens &amp;lt;userModule&amp;gt;/&amp;lt;package&amp;gt;=io.github.jpersist.tools.hibernate.orm,io.github.jpersist.tools.hibernate&lt;/code&gt; flags for the forked worker JVM. Production encapsulation stays completely intact, while build-time tools get temporary, scoped reflective access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dual-Layer SPI Resolution (&lt;code&gt;ModuleLayer&lt;/code&gt; vs. &lt;code&gt;ClassLoader&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Because workers can now boot either on a JPMS &lt;code&gt;--module-path&lt;/code&gt; or a traditional &lt;code&gt;ClassLoader&lt;/code&gt;, our underlying SPI resolution layer (&lt;code&gt;PersistenceServiceResolver&lt;/code&gt;) adapts dynamically inside the worker process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When &lt;code&gt;ModuleLayer.boot()&lt;/code&gt; contains our &lt;code&gt;io.github.jpersist.tools.api&lt;/code&gt; module, factories (&lt;code&gt;NamedObjectParserFactory&lt;/code&gt;, &lt;code&gt;SchemaValidatorFactory&lt;/code&gt;, &lt;code&gt;EnhancerProvider&lt;/code&gt;) are discovered via &lt;code&gt;ServiceLoader.load(ModuleLayer.boot(), serviceType)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Otherwise, it falls back seamlessly to &lt;code&gt;Thread.currentThread().contextClassLoader&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Fine-Tuning Provider Behavior with Custom &lt;code&gt;settings&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Real-world enterprise schemas often rely on custom SQL dialects, specific default schemas, or strict JPA compliance flags. In &lt;strong&gt;v1.9.0&lt;/strong&gt;, we also exposed &lt;code&gt;@Input @Optional MapProperty&amp;lt;String, Object&amp;gt; getSettings()&lt;/code&gt; across both &lt;code&gt;LinterExtension&lt;/code&gt; and &lt;code&gt;ValidationExtension&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;persistence&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;validation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'hibernate.default_schema'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'APP_CORE'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'hibernate.physical_naming_strategy'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy'&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;linter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'hibernate.dialect'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'org.hibernate.dialect.PostgreSQLDialect'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'hibernate.jpa.compliance.query'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These properties are serialized cleanly across the Gradle Configuration Cache boundary and passed directly into the isolated worker's SPI factory initialization.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Engineering Win
&lt;/h3&gt;

&lt;p&gt;By combining hybrid worker isolation with bytecode-level &lt;code&gt;ModuleDescriptor&lt;/code&gt; inspection, &lt;strong&gt;JPersist v1.9.0&lt;/strong&gt; removes the friction of adopting JPMS in enterprise persistence projects:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clean Production Descriptors:&lt;/strong&gt; Zero need to pollute &lt;code&gt;module-info.java&lt;/code&gt; with build-tool-only &lt;code&gt;opens&lt;/code&gt; directives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Overhead for Legacy Modules:&lt;/strong&gt; Non-modular subprojects inside the same multi-module build continue running in-process without spawning extra JVMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Vendor Control:&lt;/strong&gt; Custom dialects, naming strategies, and compliance settings propagate cleanly into isolated worker sandboxes.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Are you adopting JPMS (&lt;code&gt;module-info.java&lt;/code&gt;) in your enterprise Java builds, and what build-tool hurdles have you run into? Let's discuss in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🔗 Explore the complete JPersist architecture on GitHub: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>gradle</category>
      <category>jpms</category>
      <category>hibernate</category>
    </item>
    <item>
      <title>Gradle Under the Hood: Designing a Federated Plugin Architecture for Diverse JPA Providers</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Thu, 12 Nov 2026 08:30:00 +0000</pubDate>
      <link>https://dev.to/yannickebongue/gradle-under-the-hood-polymorphic-bytecode-weaving-and-designing-a-unified-jpa-spi-1b7f</link>
      <guid>https://dev.to/yannickebongue/gradle-under-the-hood-polymorphic-bytecode-weaving-and-designing-a-unified-jpa-spi-1b7f</guid>
      <description>&lt;p&gt;Over the first three articles of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we explored incremental source tracking, network-immune classloader harvesting, and compile-only dependency isolation. &lt;/p&gt;

&lt;p&gt;Today, in the grand finale of this series, we tackle our biggest architectural challenge: &lt;strong&gt;How do you build a cohesive build automation suite that supports three completely different object-relational mapping (ORM) frameworks—Hibernate, EclipseLink, and Apache OpenJPA—without creating a monolithic, tightly-coupled mess of conflicting dependencies?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's dive into how we designed a &lt;strong&gt;Federated Plugin Architecture&lt;/strong&gt; in &lt;strong&gt;JPersist&lt;/strong&gt; to orchestrate specialized bytecode transformations while isolating complex provider-specific execution graphs.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ecosystem Fragmentation Trap
&lt;/h3&gt;

&lt;p&gt;Compile-time bytecode modification is the holy grail of JPA performance. By weaving change-tracking or lazy-loading hooks directly into compiled &lt;code&gt;.class&lt;/code&gt; binaries post-compilation, you eliminate the need for heavy runtime reflection proxies or fragile &lt;code&gt;-javaagent&lt;/code&gt; startup flags.&lt;/p&gt;

&lt;p&gt;However, each major persistence provider drives its enhancement engine through radically different internal APIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hibernate&lt;/strong&gt; relies on an intensive programmatic cycle (&lt;code&gt;org.hibernate.bytecode.spi.Enhancer&lt;/code&gt;) requiring granular execution parameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EclipseLink&lt;/strong&gt; uses an offline processor (&lt;code&gt;StaticWeaveProcessor&lt;/code&gt;) that consumes raw file paths and streams metadata through explicit directory structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apache OpenJPA&lt;/strong&gt; uses a standalone CLI driver utility (&lt;code&gt;PCEnhancer&lt;/code&gt;) driven by command-line arguments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try to jam all three framework dependencies into a single, monolithic Gradle plugin, you create a dependency nightmare. Conflicting versions of bytecode manipulation libraries leak into the global Gradle build daemon classpath, causing silent build-time crashes and memory leaks.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: A Federated Plugin Architecture
&lt;/h3&gt;

&lt;p&gt;To achieve clean separation of concerns, we designed a &lt;strong&gt;Federated Plugin Architecture&lt;/strong&gt;. Instead of one monolithic plugin, &lt;strong&gt;JPersist&lt;/strong&gt; provides a modular suite of specialized sibling plugins that users can apply independently depending on their stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;io.github.jpersist.jpa&lt;/code&gt; (The Core Plugin)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;io.github.jpersist.hibernate-persistence&lt;/code&gt; (The Hibernate Optimization Suite)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;io.github.jpersist.openjpa-persistence&lt;/code&gt; (The Apache OpenJPA Suite)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;io.github.jpersist.eclipse-persistence&lt;/code&gt; (The EclipseLink Static Weaving Plugin)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The core plugin acts as the orchestrator. It manages the central &lt;code&gt;persistence {}&lt;/code&gt; DSL extension container, registers global configuration spaces like &lt;code&gt;modelgenProcessor&lt;/code&gt;, and auto-discovers annotated entities via a high-speed, lightweight ASM scanner.&lt;/p&gt;

&lt;p&gt;The sibling provider plugins then plug directly into this core infrastructure. They read configuration states from the central extension and register their own specialized, framework-native enhancement tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Divergent Execution Strategies: Workers vs. Process Forks
&lt;/h3&gt;

&lt;p&gt;Because the plugins are decoupled, we were free to engineer the exact execution strategy that best fits each framework's unique constraints, rather than forcing a one-size-fits-all model.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Hibernate: The ClassLoader-Isolated Worker SPI
&lt;/h4&gt;

&lt;p&gt;Hibernate carries a dual-namespace problem: legacy projects still target the &lt;code&gt;javax.persistence&lt;/code&gt; namespace (Hibernate 5), while modern ones target &lt;code&gt;jakarta.persistence&lt;/code&gt; (Hibernate 6). &lt;/p&gt;

&lt;p&gt;To manage this safely, the Hibernate plugin delegates bytecode transformation to a dedicated Service Provider Interface (SPI) module (&lt;code&gt;persistence-tools-api&lt;/code&gt;) executing inside a hermetic Gradle Worker sandbox (&lt;code&gt;classLoaderIsolation&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside HibernateEnhancementPlugin.groovy (v1.8.1)&lt;/span&gt;
&lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;enhanceTaskProvider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enhanceTaskName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HibernateEnhancementTask&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;jpaVersion&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;activeVersionProvider&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;// Wire the project's native compile classpath directly to satisfy legacy engines&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;enhanceClasspath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enhanceConfigProvider&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;enhanceClasspath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JakartaPersistencePlugin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;resolvePersistenceToolsFiles&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activeVersionProvider&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compileClasspath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compileClasspath&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underlying &lt;code&gt;EnhancementWorker&lt;/code&gt; uses Java's native &lt;code&gt;ServiceLoader&lt;/code&gt; API inside the sandbox to dynamically discover the correct environment adapter matching the module's target JPA version.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. EclipseLink &amp;amp; OpenJPA: Lightweight Java Exec Forks
&lt;/h4&gt;

&lt;p&gt;Unlike Hibernate, EclipseLink and OpenJPA drive their weaving routines via standalone main-class CLI processors (&lt;code&gt;StaticWeave&lt;/code&gt; and &lt;code&gt;PCEnhancer&lt;/code&gt;). Running them inside the main Gradle daemon classpath would contaminate the environment.&lt;/p&gt;

&lt;p&gt;Instead of writing complex worker code, our specialized tasks extend Gradle's built-in &lt;code&gt;DefaultTask&lt;/code&gt; and use an injected &lt;code&gt;ExecOperations&lt;/code&gt; service to fork a completely isolated, short-lived JVM process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside OpenJPAEnhanceTask.groovy (v1.8.1)&lt;/span&gt;
&lt;span class="nd"&gt;@TaskAction&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;enhance&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Stage raw compiled classes into the isolated target output directory first&lt;/span&gt;
    &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;copy&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;spec&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sourceClassesDir&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;into&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;targetClassesDir&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Fork OpenJPA's PCEnhancer in a detached JVM process boundary&lt;/span&gt;
    &lt;span class="n"&gt;execOperations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;javaexec&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;spec&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;mainClass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'org.apache.openjpa.enhance.PCEnhancer'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;classpath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enhancerClasspath&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;compileClasspath&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resourcesDir&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'-directory'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;targetClassesDir&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;asFile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;absolutePath&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;...)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This delivers optimal execution speeds. The heavy framework dependencies are loaded exclusively within a transient process fork, keeping the main Gradle daemon completely clean.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ultimate Engineering Victory
&lt;/h3&gt;

&lt;p&gt;By adopting a federated plugin layout combined with tailored execution strategies, the &lt;strong&gt;JPersist Suite&lt;/strong&gt; balances developer productivity with bulletproof build engineering:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Absolute ClassLoader Safety:&lt;/strong&gt; The Gradle daemon remains pristine. It never loads an internal class from Hibernate, EclipseLink, or OpenJPA into its root context, completely eliminating memory leaks and cross-plugin linkage errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailored Performance:&lt;/strong&gt; Heavy, namespace-shifting frameworks run inside classloader-isolated worker sandboxes, while CLI-driven frameworks execute via rapid process forks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infinite Extensibility:&lt;/strong&gt; Adding a new ORM provider or updating a framework version requires zero changes to the core plugin code. You simply release a new standalone sibling plugin that reads from the shared core extensions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This wraps up our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series! We built an automation platform that is blazing fast through source-driven incremental tracking, immune to network drops via ClassLoader harvesting, container-compliant through compile-only scopes, and beautifully modular through a federated plugin architecture.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;How do you handle multi-framework automation or isolate conflicting dependency graphs inside your enterprise build engineering pipelines? Let's discuss in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🔗 Explore the complete JPersist open-source architecture on GitHub: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>gradle</category>
      <category>hibernate</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Gradle Under the Hood: Thin Archives and Preventing Runtime Classpath Pollution in Jakarta EE</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Mon, 09 Nov 2026 09:30:00 +0000</pubDate>
      <link>https://dev.to/yannickebongue/gradle-under-the-hood-thin-archives-and-preventing-runtime-classpath-pollution-in-jakarta-ee-1ip1</link>
      <guid>https://dev.to/yannickebongue/gradle-under-the-hood-thin-archives-and-preventing-runtime-classpath-pollution-in-jakarta-ee-1ip1</guid>
      <description>&lt;p&gt;In the first two entries of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we looked at source-driven incremental tracking and how we engineered network-immune sandboxes using ClassLoader harvesting. &lt;/p&gt;

&lt;p&gt;Today, we shift our focus from build-time execution performance to &lt;strong&gt;deployment safety and packaging compliance&lt;/strong&gt;. Let's discuss why narrowing dynamic dependency propagation to exclusive &lt;code&gt;compileOnly&lt;/code&gt; scopes is crucial when building plugins that target enterprise application servers, and how we hardened this boundary in &lt;strong&gt;JPersist&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Enterprise Server Reality: Shared Runtimes
&lt;/h3&gt;

&lt;p&gt;When deploying enterprise Java/Jakarta EE applications to robust application servers (such as WildFly, WebSphere Liberty, GlassFish, or Payara), you enter a container-managed world. These runtime environments already provide and manage their own core persistence layers. They bundle production-ready JPA providers (typically highly tuned versions of Hibernate or EclipseLink) out of the box.&lt;/p&gt;

&lt;p&gt;Because the container provides the infrastructure, the industry-standard best practice is to build &lt;strong&gt;Thin Archives&lt;/strong&gt; (lightweight WAR or EAR files). Your deployment binaries should only carry your business logic and lightweight application configurations—never the heavy framework jars themselves.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Implicit Configuration Pollution
&lt;/h3&gt;

&lt;p&gt;When designing a Gradle plugin to automate persistence configurations (like static metamodel generation or compile-time named query validation), the plugin must provision the targeted JPA provider libraries so that the compiler and the annotation processors can map entity metadata:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A typical, naive plugin dependency injection mapping&lt;/span&gt;
&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;named&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"implementation"&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;configure&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"org.hibernate.orm:hibernate-core:6.6.0.Final"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why this breaks production deployments:&lt;/strong&gt;&lt;br&gt;
By injecting the provider directly into the standard &lt;code&gt;implementation&lt;/code&gt; or &lt;code&gt;runtimeOnly&lt;/code&gt; configurations, your plugin inadvertently introduces a severe architectural defect: &lt;strong&gt;runtime classpath pollution.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the developer executes &lt;code&gt;./gradlew build&lt;/code&gt; or &lt;code&gt;./gradlew bootWar&lt;/code&gt;, Gradle bundles the heavy, transitive Hibernate or EclipseLink JAR files directly inside the final packaged production archive (&lt;code&gt;WEB-INF/lib/&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;When this polluted archive is deployed onto an enterprise Jakarta EE container, a massive ClassLoader conflict occurs. The application server's native classloader (carrying its own provided JPA runtime classes) collides with the overlapping dependencies bundled inside your thin archive. This results in unpredictable runtime crashes, such as &lt;code&gt;LinkageError&lt;/code&gt;, &lt;code&gt;ClassCastException&lt;/code&gt;, or unexpected metadata initialization failures.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Solution: Surgical CompileOnly and Processor Isolation
&lt;/h3&gt;

&lt;p&gt;To protect production packaging workflows while maintaining full access to static metamodel generation and compile-time linting utilities, we completely overhauled the dependency propagation matrix in the core &lt;strong&gt;JPersist&lt;/strong&gt; plugins.&lt;/p&gt;

&lt;p&gt;We broke the implicit inheritance chains and isolated the &lt;code&gt;jpa&lt;/code&gt; configuration mappings to target exclusively compilation and annotation processing scopes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside JakartaPersistencePlugin.groovy&lt;/span&gt;
&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;extensions&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getByType&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SourceSetContainer&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;configureEach&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;sourceSet&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="c1"&gt;// Create our localized jpa configuration container&lt;/span&gt;
    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;jpaProvider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'jpa'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;canBeConsumed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;canBeResolved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Narrow down propagation strictly to compilation and processing boundaries&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hasPlugin&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JavaLibraryPlugin&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;extendProjectConfigurations&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;jpaProvider&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compileOnlyApiConfigurationName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;       &lt;span class="c1"&gt;// Target compile-time API boundaries&lt;/span&gt;
            &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;annotationProcessorConfigurationName&lt;/span&gt;   &lt;span class="c1"&gt;// Target processing scopes&lt;/span&gt;
        &lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;extendProjectConfigurations&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;jpaProvider&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compileOnlyConfigurationName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;// Target standard compileOnly&lt;/span&gt;
            &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;annotationProcessorConfigurationName&lt;/span&gt;   &lt;span class="c1"&gt;// Target processing scopes&lt;/span&gt;
        &lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Metamodel Processor Fallback Coordination
&lt;/h3&gt;

&lt;p&gt;By limiting framework dependencies to &lt;code&gt;compileOnly&lt;/code&gt;, we hit another Gradle edge case: &lt;em&gt;What happens if a developer applies our plugin for automated canonical metamodel generation, but doesn't declare any explicit JPA implementation in their build script?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To keep the setup completely frictionless, the plugin registers a deferred evaluation fallback. It checks if the &lt;code&gt;modelgenProcessor&lt;/code&gt; or &lt;code&gt;enhancement&lt;/code&gt; configurations are empty during the &lt;code&gt;afterEvaluate&lt;/code&gt; phase, and if so, safely provisions the correct default coordinates &lt;em&gt;only&lt;/em&gt; for the build-time processor context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;afterEvaluate&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;globalConfigName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'modelgenProcessor'&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;names&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;globalConfigName&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;named&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;globalConfigName&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;configure&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="c1"&gt;// Fallback coordination: Only provision if the developer hasn't added an explicit override&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isEmpty&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;globalConfigName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'org.apache.openjpa:openjpa'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Engineering Win
&lt;/h3&gt;

&lt;p&gt;By transitioning to surgical &lt;code&gt;compileOnly&lt;/code&gt; extensions and isolating processing dependencies, we secured a cleaner build and deployment lifecycle:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pristine Production Archives:&lt;/strong&gt; Packaged WAR or EAR files remain lightweight, thin, and container-compliant. Your plugins will never accidentally leak heavy framework binaries into production deployment environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero ClassLoader Collisions:&lt;/strong&gt; By relying on the application server's provided JPA context at runtime, you eliminate the risk of version mismatch crashes between bundled dependencies and container-provided classes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncompromised Developer Experience:&lt;/strong&gt; Developers retain full IDE autocompletion, compile-time type-safety, robust static metamodel generation, and deep query linting during local compilation loops, with zero runtime pollution overhead.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In &lt;strong&gt;Part 4&lt;/strong&gt; of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we will look at &lt;strong&gt;Polymorphic Bytecode Weaving&lt;/strong&gt; and discuss how we designed a unified SPI abstraction layer to orchestrate Hibernate, EclipseLink, and OpenJPA bytecode manipulation within a single build graph.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;How do you manage the boundary between build-time automation dependencies and container-provided runtime classes in your enterprise build configurations? Let's discuss in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🔗 Check out the JPersist open-source architecture: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>gradle</category>
      <category>jakartaee</category>
      <category>devops</category>
    </item>
    <item>
      <title>Gradle Under the Hood: ClassLoader Harvesting vs. Network CI Crashes</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Thu, 05 Nov 2026 08:30:00 +0000</pubDate>
      <link>https://dev.to/yannickebongue/gradle-under-the-hood-classloader-harvesting-vs-network-ci-crashes-5bg4</link>
      <guid>https://dev.to/yannickebongue/gradle-under-the-hood-classloader-harvesting-vs-network-ci-crashes-5bg4</guid>
      <description>&lt;p&gt;In the first article of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we explored how we decoupled incremental build tracking from volatile compiler outputs to achieve bulletproof caching. &lt;/p&gt;

&lt;p&gt;Today, we dive into a critical continuous integration (CI) dilemma that almost every plugin author faces: &lt;strong&gt;How do you execute complex, isolated task workloads on headless CI nodes without crashing due to missing network dependencies or restricted local caches?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s unpack how we engineered the &lt;strong&gt;JPersist Suite&lt;/strong&gt; verification engines to harvest their own running binary classpaths on-the-fly, how that architectural assumptions shattered across older Gradle versions, and how we leveraged native classpath streaming to achieve bulletproof reliability in our latest &lt;code&gt;v1.8.1&lt;/code&gt; patch.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Headless CI Dilemma
&lt;/h3&gt;

&lt;p&gt;To protect the Gradle build daemon from memory leaks and classpath contamination, advanced automation tasks must run inside a sandbox. Gradle provides the magnificent &lt;strong&gt;Worker API&lt;/strong&gt;, allowing you to execute tasks via isolated classloaders (&lt;code&gt;classLoaderIsolation&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;workerExecutor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;classLoaderIsolation&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;workerSpec&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;workerSpec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;classpath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;toolsetFiles&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}.&lt;/span&gt;&lt;span class="na"&gt;submit&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyValidationWorker&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Where it breaks on CI runners:&lt;/strong&gt;&lt;br&gt;
To populate &lt;code&gt;toolsetFiles&lt;/code&gt;, a plugin typically declares an internal detached configuration and injects remote text coordinates (GAV format):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;detachedConfigName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"io.github.jpersist.tools:persistence-tools-api:3.0.0"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When running in a standard developer workspace, this works fine. But in a highly isolated, enterprise continuous integration runner (or mono-repository workspaces where individual component segments are built independently), this text-based lookup introduces massive fragility:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the required companion library artifacts have not been officially merged and pushed to Maven Central yet, the resolution crashes with a &lt;code&gt;ModuleNotFoundException&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If your CI pipelines restrict or completely disable access to &lt;code&gt;mavenLocal()&lt;/code&gt;, sibling projects cannot share local intermediate build caches.&lt;/li&gt;
&lt;li&gt;Forcing remote dependency resolution loops over internal libraries during a task execution step slows down your CI velocity.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The First Iteration: ClassLoader Harvesting (v1.8.0)
&lt;/h3&gt;

&lt;p&gt;While building &lt;strong&gt;JPersist v1.8.0&lt;/strong&gt;, we asked ourselves: &lt;em&gt;Why are we forcing Gradle to perform a slow, network-bound dependency lookup against Maven Central for library classes that the plugin itself is already running on?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Since your primary plugin (e.g., &lt;code&gt;hibernate-persistence-gradle-plugin&lt;/code&gt;) already declares a dependency on the core tools API module to compile, those physical classes &lt;strong&gt;are already loaded into memory by the Plugin’s ClassLoader&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of using text coordinates, we introduced &lt;strong&gt;ClassLoader Harvesting&lt;/strong&gt;. The plugin programmatically queried its own running runtime environment to discover the exact physical &lt;code&gt;.jar&lt;/code&gt; file path on disk hosting the core contracts, and fed those file handles straight to the isolated Worker via protection domain lookups:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Our initial v1.8.0 lookups implementation&lt;/span&gt;
&lt;span class="n"&gt;Class&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;?&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;providerClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Class&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forName&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;markerClassName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;classLoader&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;codeSourceLocation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;providerClass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;protectionDomain&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;codeSource&lt;/span&gt;&lt;span class="o"&gt;?.&lt;/span&gt;&lt;span class="na"&gt;location&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This successfully generated a clean local file collection array, completely insulating the task action from network overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Plot Twist: Cross-Version Version Alignment
&lt;/h3&gt;

&lt;p&gt;We rolled out this design, and our local test suites under modern Gradle 9.x were glowing green. However, real-world integration testing against older long-term support (LTS) streams—specifically &lt;strong&gt;Gradle 7.6.6 and Gradle 8.7&lt;/strong&gt;—unveiled subtle API signature and dependency lifecycle discrepancies that we hadn't anticipated.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lazy vs. Eager Extensions:&lt;/strong&gt; Under Gradle 9.x, the &lt;code&gt;Configuration.extendsFrom()&lt;/code&gt; method natively unwraps lazy &lt;code&gt;NamedDomainObjectProvider&lt;/code&gt; targets. In Gradle 8.x, passing a provider directly threw a &lt;code&gt;MissingMethodExecutionFailed&lt;/code&gt; exception because the legacy eager API strictly expected a realized &lt;code&gt;Configuration&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Transitive Sandbox Leak:&lt;/strong&gt; In mixed multi-project environments (where one project sub-module runs a legacy Hibernate 5 stack and another runs a modern Hibernate 6 stack), Gradle 7.x's older configuration engine aggressively elevated the dependency graph inside detached file scopes. Hibernate 6 classes accidentally leaked into our Hibernate 5 worker sandbox, stripping away legacy methods and breaking tasks with a critical &lt;code&gt;NoSuchMethodError&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The v1.8.1 Evolution: Native Classpath Streaming
&lt;/h3&gt;

&lt;p&gt;To guarantee 100% universal stability across Gradle 7.6.6, 8.7, and 9.x without hardcoding user-space definitions, we evolved our &lt;strong&gt;ClassLoader Harvesting&lt;/strong&gt; implementation into a more robust two-tier pattern.&lt;/p&gt;

&lt;p&gt;First, we isolated the version lookup itself. Instead of scraping runtime class paths on the fly, the plugin now references a lean &lt;code&gt;persistence-plugin-info.properties&lt;/code&gt; file generated incrementally at build time. This reads the exact published coordinate version out of a detached configuration, resolving smoothly without leaking transitive scopes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="n"&gt;ConfigurableFileCollection&lt;/span&gt; &lt;span class="nf"&gt;resolvePersistenceToolsFiles&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Project&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Provider&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;jpaVersionProvider&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jpaVersionProvider&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
    &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;isLegacy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;isLegacyJpaVersion&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;providerArtifact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;isLegacy&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"persistence-tools-legacy"&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"persistence-tools-jakarta"&lt;/span&gt;

    &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;toolsVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"3.0.0"&lt;/span&gt; &lt;span class="c1"&gt;// Baseline safe fallback&lt;/span&gt;
    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Properties&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;resourceStream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JakartaPersistencePlugin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;classLoader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getResourceAsStream&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"persistence-plugin-info.properties"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resourceStream&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;resourceStream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withCloseable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;props&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;load&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;toolsVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;props&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getProperty&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"persistence-tools.version"&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;trim&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;detachedConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;detachedConfiguration&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"io.github.jpersist.tools:providerArtifact:{toolsVersion}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;detachedConfig&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second, we paired this with &lt;strong&gt;Native Classpath Streaming&lt;/strong&gt;. We bypassed raw, unchecked file collections entirely and mapped the task's execution graph straight to the project's native compilation classpath provider. &lt;/p&gt;

&lt;p&gt;By feeding &lt;code&gt;sourceSet.compileClasspath&lt;/code&gt; directly into the task's configuration container, Gradle's native resolution engine handles conflicts, dependency trees, and caching boundaries naturally at execution time while remaining completely backward compatible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside HibernateEnhancementPlugin.groovy (v1.8.1)&lt;/span&gt;
&lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;enhanceConfigName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'main'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"hibernateEnhanceClasspath"&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"\${sourceSet.name}HibernateEnhanceClasspath"&lt;/span&gt;
&lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;enhanceConfigProvider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enhanceConfigName&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;canBeConsumed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;canBeResolved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

    &lt;span class="c1"&gt;// Eagerly unpack via .get() for Gradle 8.x signature compatibility&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;extendsFrom&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;configurations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;named&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compileClasspathConfigurationName&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Wire the lazy file collections straight into the task configuration graph&lt;/span&gt;
&lt;span class="n"&gt;enhanceTask&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;enhanceClasspath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enhanceConfigProvider&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;enhanceTask&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;enhanceClasspath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JakartaPersistencePlugin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;resolvePersistenceToolsFiles&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activeVersionProvider&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Engineering Win
&lt;/h3&gt;

&lt;p&gt;By combining localized classloader resource harvesting with native compilation classpath streaming, we secured three major structural improvements for our users:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;100% Offline Independence:&lt;/strong&gt; The isolated worker tasks (&lt;code&gt;validatePersistenceSchema&lt;/code&gt;, &lt;code&gt;lintNamedQueries&lt;/code&gt;, and &lt;code&gt;hibernateEnhance&lt;/code&gt;) can run completely offline on headless CI nodes. They don't care about &lt;code&gt;mavenLocal()&lt;/code&gt; locks or staging delays on remote repositories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Absolute Lifecycle Parity:&lt;/strong&gt; Whether your enterprise application is running on Gradle 7.6.6, Gradle 8.7, or cutting-edge Gradle 9.x matrices, the configuration-time signatures match perfectly without crashing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pristine Daemon State:&lt;/strong&gt; Tool binaries are contained strictly within the worker's parent context, keeping the global Gradle daemon's main classpath clean and unpolluted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In &lt;strong&gt;Part 3&lt;/strong&gt; of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we will look at &lt;strong&gt;Thin Archives&lt;/strong&gt; and discuss why narrowing dynamic dependency propagation to exclusive &lt;code&gt;compileOnly&lt;/code&gt; scopes is crucial to prevent runtime classpath pollution in enterprise Jakarta EE application servers.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What are your experiences dealing with classloader leakage or configuration API breaks between different Gradle lifecycles? Let's discuss in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🔗 Check out the JPersist open-source architecture: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>gradle</category>
      <category>devops</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Gradle Under the Hood: Fighting Incremental Cache Misses in Bytecode Processing</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Sun, 01 Nov 2026 11:47:50 +0000</pubDate>
      <link>https://dev.to/yannickebongue/gradle-under-the-hood-fighting-incremental-cache-misses-in-bytecode-processing-36aa</link>
      <guid>https://dev.to/yannickebongue/gradle-under-the-hood-fighting-incremental-cache-misses-in-bytecode-processing-36aa</guid>
      <description>&lt;p&gt;If you have ever written a custom Gradle task to analyze or process compiled bytecode (like custom linters, schema validators, or metadata generators), you have probably encountered a hidden, silent performance killer: &lt;strong&gt;the aggressive compiler erasure.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this first article of our &lt;em&gt;Gradle Under the Hood&lt;/em&gt; series, we’ll explore how we re-engineered the incremental tracking of &lt;strong&gt;JPersist&lt;/strong&gt; (a zero-boilerplate JPA build automation suite) to achieve bulletproof &lt;code&gt;UP-TO-DATE&lt;/code&gt; execution states, even when the Java compiler tries to destroy your task's cache.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Naive Approach to Bytecode Tasks
&lt;/h3&gt;

&lt;p&gt;When building a task that processes compiled &lt;code&gt;.class&lt;/code&gt; files, the most intuitive setup is to declare the compiler's output directory as your task's &lt;code&gt;@InputDirectory&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyBytecodeTask&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DefaultTask&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@InputDirectory&lt;/span&gt;
    &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="n"&gt;DirectoryProperty&lt;/span&gt; &lt;span class="nf"&gt;getCompiledClassesDir&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;

    &lt;span class="nd"&gt;@TaskAction&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;InputChanges&lt;/span&gt; &lt;span class="n"&gt;inputChanges&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Process altered files...&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You then wire it in your plugin by binding it to the &lt;code&gt;JavaCompile&lt;/code&gt; task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getCompiledClassesDir&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;compileJavaTask&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;flatMap&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;destinationDirectory&lt;/span&gt; &lt;span class="o"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why this fails in the real world:&lt;/strong&gt; &lt;br&gt;
Gradle has a magnificent incremental build engine. However, &lt;code&gt;JavaCompile&lt;/code&gt; is highly defensive. When a developer alters even a single line of Java source code, &lt;code&gt;JavaCompile&lt;/code&gt; often &lt;strong&gt;wipes out its entire destination directory&lt;/strong&gt; (&lt;code&gt;build/classes/java/main&lt;/code&gt;) before rebuilding to guarantee no stale classes remain.&lt;/p&gt;

&lt;p&gt;For your downstream bytecode task, this folder deletion is catastrophic. Even though you are using Gradle's &lt;code&gt;InputChanges&lt;/code&gt; API, the engine sees that the root directory was destroyed and recreated. It panics, concludes that the historical file snapshot graph is non-linear, and forces &lt;code&gt;inputChanges.incremental&lt;/code&gt; to evaluate to &lt;code&gt;false&lt;/code&gt;. Your task is forced into a heavy, full-pass execution loop on every minor code tweak.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Solution: Source-Driven Incremental Tracking
&lt;/h3&gt;

&lt;p&gt;To make our query linters and schema validators truly incremental and immune to compiler erasures, we shifted our architectural paradigm: &lt;strong&gt;We stopped tracking the volatile compiler output folder and started tracking the stable source code repository layout instead.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of listening to the &lt;code&gt;.class&lt;/code&gt; directory, our tasks now listen to &lt;code&gt;sourceSet.java.sourceDirectories&lt;/code&gt; as a flat &lt;code&gt;@InputFiles&lt;/code&gt; collection wrapper:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ValidatePersistenceSchema&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DefaultTask&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@Incremental&lt;/span&gt;
    &lt;span class="nd"&gt;@InputFiles&lt;/span&gt;
    &lt;span class="nd"&gt;@PathSensitive&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PathSensitivity&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;RELATIVE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="n"&gt;ConfigurableFileCollection&lt;/span&gt; &lt;span class="nf"&gt;getSourceFiles&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;

    &lt;span class="nd"&gt;@InputDirectory&lt;/span&gt; &lt;span class="c1"&gt;// Kept as standard non-incremental input&lt;/span&gt;
    &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="n"&gt;DirectoryProperty&lt;/span&gt; &lt;span class="nf"&gt;getCompiledClassesDir&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside our plugin wiring loop, we feed it lazily while filtering out any intermediate or generated build directories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getSourceFiles&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sourceSet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;java&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sourceDirectories&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asFileTree&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;matching&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;exclude&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;element&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;absolutePath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\\'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;buildDirectory&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;asFile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;absolutePath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\\'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Mapping Source Deltas to Bytecode Outputs
&lt;/h3&gt;

&lt;p&gt;Because source directories are managed by the developer and are never aggressively wiped out by a compiler task, Gradle's file system snapshot engine maintains a perfect, unbroken lineage of mutations. &lt;/p&gt;

&lt;p&gt;When a developer modifies an entity, &lt;code&gt;InputChanges&lt;/code&gt; accurately catches exactly &lt;strong&gt;one modified &lt;code&gt;.java&lt;/code&gt; file&lt;/strong&gt;. Inside our &lt;code&gt;@TaskAction&lt;/code&gt;, we intercept this &lt;code&gt;.java&lt;/code&gt; path, compute its relative package structure, and translate it on-the-fly to find the corresponding compiled &lt;code&gt;.class&lt;/code&gt; file inside the freshly compiled folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="nd"&gt;@TaskAction&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;InputChanges&lt;/span&gt; &lt;span class="n"&gt;inputChanges&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;affectedEntities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inputChanges&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;incremental&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;inputChanges&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getFileChanges&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;getSourceFiles&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;each&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;change&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;change&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;endsWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.java'&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;relativePath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;change&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;normalizedPath&lt;/span&gt;
                &lt;span class="c1"&gt;// Translate com/example/model/User.java -&amp;gt; com.example.model.User&lt;/span&gt;
                &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;relativePath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;substring&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;relativePath&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;lastIndexOf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'.java'&lt;/span&gt;&lt;span class="o"&gt;)).&lt;/span&gt;&lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'.'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;change&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;changeType&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;ChangeType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;REMOVED&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;affectedEntities&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="c1"&gt;// Fast-Exit Pass: If no active entities were touched, skip heavy DB bootstrapping!&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;affectedEntities&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isEmpty&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;affectedEntities&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addAll&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fullDiscoveredEntityList&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Submit isolated work wrapper with precisely filtered entity subsets...&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Engineering Win
&lt;/h3&gt;

&lt;p&gt;By decoupling task delta tracking from the volatile compilation output graph, we achieved major engineering victories for the &lt;strong&gt;JPersist v1.8.0&lt;/strong&gt; release pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Immunity to Directory Purges:&lt;/strong&gt; Even if &lt;code&gt;JavaCompile&lt;/code&gt; erases and rewrites 5,000 class files, our tasks compare the stable source metadata signatures. If only 1 file changed, we only process 1 class binarized stream via ASM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fast-Exit Optimization:&lt;/strong&gt; If a developer edits a standard Service, Controller, or Utility class that doesn't hold JPA annotations, our tasks process the change stream in under 5 milliseconds and exit before ever spawning database connections or heavy classloaders.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Stay tuned for &lt;strong&gt;Part 2&lt;/strong&gt;, where we’ll dive into &lt;strong&gt;ClassLoader Harvesting&lt;/strong&gt; and how we forced isolated Gradle workers to run seamlessly on headless CI nodes without ever hitting network lookups or requiring &lt;code&gt;mavenLocal()&lt;/code&gt; fallbacks!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What are your thoughts on handling aggressive compiler tasks in custom Gradle plugins? Let's discuss in the comments below!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🔗 Check out the JPersist open-source architecture: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>gradle</category>
      <category>devops</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Show Dev: JPersist v1.8.0 — Hardening Gradle Build Sandbox &amp; ClassLoader Engineering for JPA</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Sat, 31 Oct 2026 22:42:04 +0000</pubDate>
      <link>https://dev.to/yannickebongue/show-dev-jpersist-v180-hardening-gradle-build-sandbox-classloader-engineering-for-jpa-26hj</link>
      <guid>https://dev.to/yannickebongue/show-dev-jpersist-v180-hardening-gradle-build-sandbox-classloader-engineering-for-jpa-26hj</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;We just published version &lt;strong&gt;v1.8.0&lt;/strong&gt; of &lt;strong&gt;JPersist&lt;/strong&gt;, an open-source ecosystem of highly optimized, Configuration Cache-compliant Gradle plugins designed to automate enterprise Jakarta Persistence (JPA) configurations.&lt;/p&gt;

&lt;p&gt;In this release, we didn't just add features (like full &lt;strong&gt;Apache OpenJPA&lt;/strong&gt; toolset orchestration) — we deep-dived into advanced Gradle task engineering to fix common continuous integration pain points.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Aggressive Compiler Erasures &amp;amp; CI Pipeline Crashes
&lt;/h3&gt;

&lt;p&gt;When writing custom incremental tasks that process bytecodes, pointing your task &lt;code&gt;@InputDirectory&lt;/code&gt; to the compiler's output directory (&lt;code&gt;build/classes/java/main&lt;/code&gt;) creates an incremental bottleneck. Why? Because whenever a single file changes, &lt;code&gt;JavaCompile&lt;/code&gt; wipes out the whole folder, destroying Gradle's historical file snapshots and causing an incremental cache miss.&lt;/p&gt;

&lt;p&gt;Furthermore, running isolated worker actions by injecting text coordinates (&lt;code&gt;group:artifact:version&lt;/code&gt;) frequently crashes headless CI nodes if those artifacts aren't fully synchronized on Maven Central yet or if &lt;code&gt;mavenLocal()&lt;/code&gt; access is disabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  How JPersist v1.8.0 Solves This:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Source-Driven Incremental Auditing:&lt;/strong&gt; Our verification tasks (&lt;code&gt;validatePersistenceSchema&lt;/code&gt; and &lt;code&gt;lintNamedQueries&lt;/code&gt;) now track flat file collection streams from &lt;code&gt;sourceSet.java.sourceDirectories&lt;/code&gt;. Because source folders are never deleted by the build, our delta tracking remains 100% stable and fast.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ClassLoader Harvesting:&lt;/strong&gt; Our plugins now dynamically query their own active ClassLoader at execution time to harvest the physical &lt;code&gt;.jar&lt;/code&gt; file protection domains of our tools API. We pass these raw file handles directly to the isolated &lt;code&gt;WorkerExecutor&lt;/code&gt;. Zero network calls, zero resolution exceptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container-Friendly Scopes:&lt;/strong&gt; We restricted dynamic injection to &lt;code&gt;compileOnly&lt;/code&gt; and &lt;code&gt;annotationProcessor&lt;/code&gt;. Your packaged WAR and EAR files remain clean, lightweight, and completely free of runtime classpath pollution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are dealing with complex multi-module setups, multi-tenant databases, or looking to streamline your build performance, we'd love for you to check it out!&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub Organization:&lt;/strong&gt; &lt;a href="https://github.com/jpersist" rel="noopener noreferrer"&gt;https://github.com/jpersist&lt;/a&gt;&lt;br&gt;
🔗 &lt;strong&gt;Main Repository &amp;amp; Templates:&lt;/strong&gt; &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gradle</category>
      <category>jpa</category>
      <category>opensource</category>
      <category>java</category>
    </item>
    <item>
      <title>Show Dev: JPersist v1.7.0 — Zero-Boilerplate JPA Build Automation for Gradle</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Sat, 24 Oct 2026 22:32:46 +0000</pubDate>
      <link>https://dev.to/yannickebongue/show-dev-jpersist-v170-zero-boilerplate-jpa-build-automation-for-gradle-4l27</link>
      <guid>https://dev.to/yannickebongue/show-dev-jpersist-v170-zero-boilerplate-jpa-build-automation-for-gradle-4l27</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;If you’ve ever managed enterprise &lt;strong&gt;Jakarta Persistence (JPA)&lt;/strong&gt; setups in complex Gradle multi-module projects, you know the pain: managing verbose &lt;code&gt;&amp;lt;class&amp;gt;&lt;/code&gt; tags in &lt;code&gt;persistence.xml&lt;/code&gt;, fighting runtime exceptions caused by naming typos in &lt;code&gt;@NamedQuery&lt;/code&gt; blocks, or dealing with dirty build states because a bytecode manipulation plugin broke incremental caching rules.&lt;/p&gt;

&lt;p&gt;We built &lt;strong&gt;JPersist&lt;/strong&gt; to solve these issues permanently at build time. It is an open-source suite of modern, high-performance, and &lt;strong&gt;Gradle Configuration Cache-compliant&lt;/strong&gt; plugins that automate your entire persistence toolbelt using high-speed ASM bytecode scanning.&lt;/p&gt;

&lt;p&gt;We just pushed &lt;strong&gt;v1.7.0&lt;/strong&gt; to production, which introduces some major capabilities:&lt;/p&gt;

&lt;h3&gt;
  
  
  🌟 Core Highlights of the Suite
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compile-Time Query Linting:&lt;/strong&gt; Uses an isolated ANTLR4 parser loop to validate your &lt;code&gt;@NamedQuery&lt;/code&gt; strings against your compiled bytecode. If you make a typo in an attribute name, the build fails &lt;em&gt;before&lt;/em&gt; deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Tenant Schema Validation:&lt;/strong&gt; You can now configure multiple database connection profiles to validate your entity mappings across multiple live tenant partitions simultaneously during the &lt;code&gt;check&lt;/code&gt; lifecycle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Granular Incremental Tracking:&lt;/strong&gt; Tasks track source modifications via flat file collection streams, protecting your delta compilation metrics from aggressive &lt;code&gt;JavaCompile&lt;/code&gt; directory erasure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GraalVM Native Image Readiness:&lt;/strong&gt; Generates native reflection configurations (&lt;code&gt;reflect-config.json&lt;/code&gt;) out of the box for all discovered entities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚡ Quick Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Standard Gradle Setup&lt;/th&gt;
&lt;th&gt;The JPersist Advantage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;❌ Manual &lt;code&gt;&amp;lt;class&amp;gt;&lt;/code&gt; tagging required&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;✅ ASM-powered bytecode scanning&lt;/strong&gt; auto-detects entities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;❌ Named query errors only at runtime&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;✅ Compile-time query linting&lt;/strong&gt; catches JPQL/HQL syntax errors before deployment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;❌ Broken workspace compiler sync&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;✅ Automated IDE indexing&lt;/strong&gt; hooks into Buildship and IntelliJ out-of-the-box&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We would love to get your feedback on the architecture! If you want to check out the source code, run the multi-module example templates, or read the full user documentation guides:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;br&gt;
🔗 &lt;strong&gt;User documentation:&lt;/strong&gt; &lt;a href="https://jpersist.github.io/persistence/plugins/guide/latest/" rel="noopener noreferrer"&gt;https://jpersist.github.io/persistence/plugins/guide/latest/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gradle</category>
      <category>jpa</category>
      <category>opensource</category>
      <category>java</category>
    </item>
    <item>
      <title>How We Engineered a Zero-Boilerplate Composite Build Architecture for Enterprise Gradle Plugins</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Sun, 18 Oct 2026 15:14:49 +0000</pubDate>
      <link>https://dev.to/yannickebongue/how-we-engineered-a-zero-boilerplate-composite-build-architecture-for-enterprise-gradle-plugins-50k1</link>
      <guid>https://dev.to/yannickebongue/how-we-engineered-a-zero-boilerplate-composite-build-architecture-for-enterprise-gradle-plugins-50k1</guid>
      <description>&lt;h2&gt;
  
  
  The Monolithic Plugin Trap
&lt;/h2&gt;

&lt;p&gt;When building enterprise Gradle plugins that handle deep bytecode tasks (like our JPA linter suite, &lt;code&gt;JPersist&lt;/code&gt;), developers often fall into the &lt;strong&gt;classpath contamination trap&lt;/strong&gt;. They bundle the core Java logic, framework dependencies (like Hibernate 5/6, EclipseLink, ANTLR4), and the Gradle API into a single monolithic project. &lt;/p&gt;

&lt;p&gt;This creates massive friction for teams trying to scale:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;IDE Slowdowns:&lt;/strong&gt; The integrated development environment struggles to separate compiler scopes, leading to indexing fatigue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing Nightmares:&lt;/strong&gt; Gradle TestKit functional tests can leak runner classloaders and cause file-locking anomalies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Barriers to Entry:&lt;/strong&gt; Outside contributors get intimidated by a complex, tightly-coupled dependency tree.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To solve this permanently, we recently underwent a massive structural migration for our &lt;strong&gt;v1.6.0 release track&lt;/strong&gt;, transforming JPersist into a fully decoupled &lt;strong&gt;Symmetric Composite Build&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Blueprint: Dual Isolated &lt;code&gt;includeBuild&lt;/code&gt; Structures
&lt;/h2&gt;

&lt;p&gt;Instead of using standard nested subprojects that leak compilation classpaths, we split the repository into two entirely independent execution containers right at the root directory level:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jpersist/persistence
├── settings.gradle        &amp;lt;-- The Conductor (Combines everything)
├── libraries/             &amp;lt;-- Isolated Build (Pure Java SPI Engines)
│   ├── build.gradle
│   └── lint-persistence-api/
└── plugins/               &amp;lt;-- Isolated Build (Gradle Plugin Wrappers)
    ├── build.gradle
    └── jakarta-persistence-gradle-plugin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the root &lt;strong&gt;&lt;code&gt;settings.gradle&lt;/code&gt;&lt;/strong&gt;, we treat them as standalone environments using Gradle's &lt;code&gt;includeBuild&lt;/code&gt; directive. This connects them as a unified ecosystem without letting their classpaths collide:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;rootProject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'jpersist'&lt;/span&gt;

&lt;span class="c1"&gt;// Include the decoupled core Java logic libraries&lt;/span&gt;
&lt;span class="n"&gt;includeBuild&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'libraries'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Include the isolated Gradle plugin definitions &lt;/span&gt;
&lt;span class="n"&gt;includeBuild&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'plugins'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why This Composite Setup is a Developer Superpower
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Absolute Compile-Time Classpath Separation
&lt;/h3&gt;

&lt;p&gt;Our Java libraries inside &lt;code&gt;libraries/&lt;/code&gt; compile against native Hibernate 6 strings natively without knowing &lt;em&gt;anything&lt;/em&gt; about Gradle or plugin lifecycles. Conversely, the plugin wrappers inside &lt;code&gt;plugins/&lt;/code&gt; pull those libraries down via standard coordinate notation strings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="s1"&gt;'io.github.jpersist.lint:lint-persistence-api:2.0.0'&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During local testing, Gradle's composite build engine automatically intercepts these string coordinates and substitutes them with local project references seamlessly, eliminating manual local maven publishing steps completely.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Flawless Gradle TestKit Sandbox Testing
&lt;/h3&gt;

&lt;p&gt;When running functional integration tests via TestKit, Gradle forks a separate JVM daemon. In standard layouts, this daemon can lock file paths or leak dependencies. With the composite build layout, &lt;code&gt;plugins/&lt;/code&gt; runs tests in an isolated sandbox, pulling pristine library binaries on-the-fly without colliding with the root build caching variables.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 We're Open for Contributors! (Come Hack with Us)
&lt;/h2&gt;

&lt;p&gt;With this pristine infrastructure locked down, we are officially opening JPersist to public contributions as we kick off the &lt;strong&gt;v1.7.0 - Performance &amp;amp; Multi-Tenancy&lt;/strong&gt; tracks!&lt;/p&gt;

&lt;p&gt;Thanks to the composite build separation, onboarding is incredibly easy. You just need JDK 17, and you can compile and verify the whole project immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./gradlew &lt;span class="nt"&gt;-p&lt;/span&gt; plugins functionalTest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have just logged our very first &lt;strong&gt;&lt;code&gt;good first issue&lt;/code&gt;&lt;/strong&gt; tickets on our public roadmap project board:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ticket #68:&lt;/strong&gt; [FEAT] Global &lt;code&gt;modelgenProcessor&lt;/code&gt; Configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ticket #69:&lt;/strong&gt; [FEAT] Isolated &lt;code&gt;weavingClasspath&lt;/code&gt; Pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you love advanced build systems engineering, bytecode scanning via ASM, or messing with ANTLR4 parsers, we would love to review your Pull Requests!&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Explore the Roadmap &amp;amp; Grab an Issue:&lt;/strong&gt; &lt;a href="https://github.com/orgs/jpersist/projects" rel="noopener noreferrer"&gt;https://github.com/orgs/jpersist/projects&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gradle</category>
      <category>architecture</category>
      <category>java</category>
      <category>opensource</category>
    </item>
    <item>
      <title>🎉 Update: JPersist v1.6.0 is Live &amp; Open for Contributors!</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Tue, 13 Oct 2026 22:40:22 +0000</pubDate>
      <link>https://dev.to/yannickebongue/update-jpersist-v160-is-live-open-for-contributors-4e88</link>
      <guid>https://dev.to/yannickebongue/update-jpersist-v160-is-live-open-for-contributors-4e88</guid>
      <description>&lt;p&gt;We just shipped v1.6.0 to the Gradle Plugin Portal alongside our core query parsing engine libraries (v2.0.0) on Maven Central! &lt;/p&gt;

&lt;p&gt;To celebrate, we have officially opened the repository to outside contributors and structured our very first automated issue templates. If you are looking to get your hands dirty with deep Gradle plugin architecture, Groovy task configurations, or ASM bytecode mechanics, we have just tagged two pristine &lt;code&gt;good first issue&lt;/code&gt; tickets:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Global &lt;code&gt;modelgenProcessor&lt;/code&gt; Configuration container&lt;/strong&gt; (Easy - perfect for an overview of multi-module plugin hooks).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated Task &lt;code&gt;weavingClasspath&lt;/code&gt; Pipeline&lt;/strong&gt; (Easy-Medium - great look into Gradle task property caching).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We provide a complete step-by-step local environment setup inside our &lt;code&gt;CONTRIBUTING.md&lt;/code&gt;. Come help us make enterprise JPA pipelines faster and safer! &lt;/p&gt;

&lt;p&gt;👉 Check out the issues here: &lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;https://github.com/jpersist/persistence&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>java</category>
      <category>opensource</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>How We Solved Groovy's MissingMethodException inside Gradle Runtime Task Proxies</title>
      <dc:creator>Yannick Ebongue</dc:creator>
      <pubDate>Wed, 07 Oct 2026 14:06:32 +0000</pubDate>
      <link>https://dev.to/yannickebongue/how-we-solved-groovys-missingmethodexception-inside-gradle-runtime-task-proxies-gml</link>
      <guid>https://dev.to/yannickebongue/how-we-solved-groovys-missingmethodexception-inside-gradle-runtime-task-proxies-gml</guid>
      <description>&lt;p&gt;If you’ve ever authored a custom Gradle plugin that handles dynamic file structures using Groovy's &lt;code&gt;MarkupBuilder&lt;/code&gt; or &lt;code&gt;XmlParser&lt;/code&gt;, you have likely encountered a ghost in the machine: the dreaded &lt;strong&gt;&lt;code&gt;MissingMethodException&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It usually happens when you are refining task settings or running complex incremental build tests. Suddenly, code that passed unit tests perfectly blows up in a real-world multi-module build execution pass. &lt;/p&gt;

&lt;p&gt;Here is the deep engineering breakdown of how we encountered a hidden runtime proxy trap inside the &lt;strong&gt;Gradle Task Decoration Engine&lt;/strong&gt; while building &lt;strong&gt;jPersist v1.4.1&lt;/strong&gt;, and the design pattern we used to fix it permanently.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Target Architecture: Dynamic XML Descriptor Management
&lt;/h2&gt;

&lt;p&gt;In enterprise Jakarta Persistence (JPA) environments, managing &lt;code&gt;persistence.xml&lt;/code&gt; files in large multi-module projects is a known headache. Our plugin, &lt;code&gt;io.github.jpersist.jpa&lt;/code&gt;, solves this by automating entity class discovery via high-speed ASM bytecode scanning and generating or merging the final descriptors cleanly on the fly.&lt;/p&gt;

&lt;p&gt;To keep configuration clean, we leveraged Groovy's idiomatic &lt;code&gt;MarkupBuilder&lt;/code&gt; inside our custom task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProcessPersistenceDescriptor&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DefaultTask&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Gradle lazy property bindings...&lt;/span&gt;

    &lt;span class="nd"&gt;@TaskAction&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hasTemplate&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;merge&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;generate&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;StringWriter&lt;/span&gt; &lt;span class="n"&gt;writer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;StringWriter&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="kt"&gt;def&lt;/span&gt; &lt;span class="n"&gt;xml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;groovy&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;xml&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MarkupBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;xml&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;persistence&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;version:&lt;/span&gt; &lt;span class="s2"&gt;"3.1"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// A closure manipulating elements dynamically&lt;/span&gt;
            &lt;span class="s2"&gt;"persistence-unit"&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="s2"&gt;"app-unit"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"org.hibernate.jpa.HibernatePersistenceProvider"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks elegant, passes isolated tests, and works seamlessly—until a downstream consumer tries to mutate plugin extensions or apply complex custom build profiles. Suddenly, the build crashes with a cryptic runtime trace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: 
Could not find method generate() for arguments [...] on task ':app:processPersistenceDescriptor' 
of type persist.jakarta.gradle.task.ProcessPersistenceDescriptor_Decorated.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait, &lt;code&gt;generate()&lt;/code&gt; is a private method clearly defined right inside the task class. How can it be "missing"? And what on earth is &lt;code&gt;ProcessPersistenceDescriptor_Decorated&lt;/code&gt;?&lt;/p&gt;




&lt;h2&gt;
  
  
  The Trap: Gradle's Decorated Runtime Proxy Object
&lt;/h2&gt;

&lt;p&gt;To enforce lazy evaluation, property tracking, input validation, and incremental build snapshots caching, &lt;strong&gt;Gradle does not execute your raw task class directly.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Instead, on startup, Gradle’s internal object factory dynamically subclasses your task at runtime via bytecode generation, creating a wrapper proxy matching the pattern &lt;code&gt;${YourTaskClass}_Decorated&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  [ Your Task Class ]  &amp;lt;--- You wrote this
           ▲
           │ (Inherits &amp;amp; Overrides)
  [ YourTaskClass_Decorated ]  &amp;lt;--- Gradle executes this at runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This decorated proxy object intercepts all standard Groovy method dispatch mechanisms (&lt;code&gt;invokeMethod&lt;/code&gt;, &lt;code&gt;methodMissing&lt;/code&gt;, &lt;code&gt;propertyMissing&lt;/code&gt;) to perform its internal dependency tracking and lifecycle magic. &lt;/p&gt;

&lt;p&gt;Here is where the collision happens:&lt;br&gt;
Groovy closures (like the code block inside &lt;code&gt;xml.persistence { ... }&lt;/code&gt;) inherit the surrounding method instance as their default execution &lt;code&gt;owner&lt;/code&gt; and &lt;code&gt;delegate&lt;/code&gt;. When &lt;code&gt;MarkupBuilder&lt;/code&gt; evaluates an abstract tag entry line like &lt;code&gt;provider(...)&lt;/code&gt;, Groovy's dynamic dispatcher starts sweeping up the delegation hierarchy to resolve the call.&lt;/p&gt;

&lt;p&gt;Instead of hitting the &lt;code&gt;MarkupBuilder&lt;/code&gt; configuration graph safely, Gradle's &lt;strong&gt;public decorated proxy wrapper interceptor&lt;/strong&gt; flags the expression. Because the proxy exposes open-ended method definitions, it tricks Groovy into bypassing the builder context completely. It routes the evaluation right back into the task object instance, leading to an immediate parameters signature mismatch and a full task explosion.&lt;/p&gt;

&lt;p&gt;Marking your methods &lt;code&gt;private&lt;/code&gt; doesn't stop this, because the generated runtime proxy opens up visibility entry points to monitor task state transitions.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Masterclass Solution: The Static Processor Isolation Strategy
&lt;/h2&gt;

&lt;p&gt;To permanently insulate dynamic DSL blocks and XML parser closures from Gradle's runtime proxy manipulation, we must &lt;strong&gt;completely break the object instance chain.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If an execution closure doesn't carry a reference to a parent class object instance, Gradle's proxy wrapper has nothing to attach to. We achieved this by restructuring our plugin tasks around the &lt;strong&gt;Strategy Design Pattern&lt;/strong&gt; and encapsulating the execution logic within a &lt;strong&gt;purely static evaluation utility&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is the bulletproof architecture shipped in &lt;strong&gt;jPersist v1.4.1&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="nd"&gt;@DisableCachingByDefault&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;because&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Process overwrite persistence.xml in place"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProcessPersistenceDescriptor&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DefaultTask&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Task parameters handles strictly isolated to lazy Gradle Property wrappers&lt;/span&gt;
    &lt;span class="nd"&gt;@Input&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;getXmlVersion&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
    &lt;span class="nd"&gt;@OutputFile&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="n"&gt;RegularFileProperty&lt;/span&gt; &lt;span class="n"&gt;getDestinationFile&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;

    &lt;span class="nd"&gt;@TaskAction&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Unpack properties securely inside the safe @TaskAction boundary&lt;/span&gt;
        &lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="n"&gt;destination&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;destinationFile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;asFile&lt;/span&gt;
        &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;versionStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xmlVersion&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;

        &lt;span class="c1"&gt;// 1. Resolve processing characteristics via a Strategy Factory Registry&lt;/span&gt;
        &lt;span class="n"&gt;JpaVersionStrategyRegistry&lt;/span&gt; &lt;span class="n"&gt;strategyConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JpaVersionStrategyRegistry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;versionStr&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;// 2. PASS TO AN ISOLATED STATIC LAYER&lt;/span&gt;
        &lt;span class="c1"&gt;// This cuts off the parent instance reference, bypassing the proxy wrapper entirely!&lt;/span&gt;
        &lt;span class="n"&gt;strategyConfig&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;delegate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;process&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;destination&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;versionStr&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And inside our decoupled, static execution strategy delegate layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JPA30DescriptorProcessorDelegate&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;DescriptorProcessorDelegate&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;File&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;xmlVersion&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// All closures here evaluate inside a safe, predictable context&lt;/span&gt;
        &lt;span class="n"&gt;StringWriter&lt;/span&gt; &lt;span class="n"&gt;rawXmlWriter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;StringWriter&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;MarkupBuilder&lt;/span&gt; &lt;span class="n"&gt;xml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;MarkupBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawXmlWriter&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;xml&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;persistence&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;version:&lt;/span&gt; &lt;span class="n"&gt;xmlVersion&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Groovy now resolves these paths directly via MarkupBuilder &lt;/span&gt;
            &lt;span class="c1"&gt;// with ZERO risk of proxy interception!&lt;/span&gt;
            &lt;span class="s2"&gt;"persistence-unit"&lt;/span&gt;&lt;span class="o"&gt;([&lt;/span&gt;&lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="s2"&gt;"secure-unit"&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"org.hibernate.jpa.HibernatePersistenceProvider"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;writeOutputFile&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawXmlWriter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Engineering Takeaway
&lt;/h2&gt;

&lt;p&gt;By unpacking raw task properties inside the &lt;code&gt;@TaskAction&lt;/code&gt; boundary and passing them straight as primitives or decoupled objects into an independent &lt;strong&gt;&lt;code&gt;static class&lt;/code&gt; block&lt;/strong&gt;, we successfully cut off the parent instance reference. &lt;/p&gt;

&lt;p&gt;When Groovy looks for method resolution paths inside the &lt;code&gt;MarkupBuilder&lt;/code&gt; boundaries, it no longer crosses paths with &lt;code&gt;ProcessPersistenceDescriptor_Decorated&lt;/code&gt;. The closures run inside a completely clean environment, allowing enterprise builds to run smoothly across any configuration cache change pass.&lt;/p&gt;

&lt;p&gt;If you are building custom Gradle tooling that relies on nested builders, dynamic closures, or heavy XML transformations, save yourself days of debugging: &lt;strong&gt;Keep your tasks strictly focused on tracking input/output properties, and delegate the execution out to static processors.&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🌐 Learn More &amp;amp; Support Independence
&lt;/h3&gt;

&lt;p&gt;This architecture is part of &lt;strong&gt;jPersist&lt;/strong&gt;, an open-source, configuration-cache-compliant Gradle plugin suite that automates descriptor management, static metamodel generation, and compile-time static weaving for Hibernate and EclipseLink ecosystems.&lt;/p&gt;

&lt;p&gt;Check out the code, view runnable enterprise multi-module specs, or drop a star on GitHub:&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/jpersist/persistence" rel="noopener noreferrer"&gt;GitHub - jpersist/persistence&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If this deep-dive saved you debugging hours on your custom build pipelines, consider checking out our &lt;a href="https://github.com/sponsors/jpersist" rel="noopener noreferrer"&gt;GitHub Sponsors Tiers Profile&lt;/a&gt; to back the project's long-term independence!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>gradle</category>
      <category>java</category>
      <category>groovy</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
