← Back to Pull requests

Rewrite the packaged class path with Micronaut AOT's aot-bytecode #1747

Open
alvarosanchez opened this pull request with 1963 lines diff across 42 files
View on GitHub
alvarosanchez alvarosanchez commented on Nov 06, 2026 19:18 UTC
Author

Fixes #1739. Maven counterpart of micronaut-projects/micronaut-gradle-plugin#1399.

Adds Micronaut AOT's two class path steps (micronaut-projects/micronaut-aot#524 and #527, released in 3.2.0-M1), both off by default:

<properties>
  <micronaut.classPathTransform.desugarLambdas>true</micronaut.classPathTransform.desugarLambdas>
  <micronaut.classPathTransform.stripLocalVariables>true</micronaut.classPathTransform.stripLocalVariables>
</properties>

What it does:

  • The jar packaging's package phase now runs mn:transform-class-path before shade and mn:restore-class-path after it. The shaded JAR is built from the rewritten application JAR and dependencies, and the originals are put back afterwards. With both options off, both goals do nothing.

  • mn:docker packages the rewritten class path, both through Jib and in the JDK AOT cache flow, so the cache trains on the rewritten JARs.

  • mn:dockerfile with the default Docker packaging copies the rewritten classes and dependencies.

  • Only third-party JARs (outside the reactor) are stripped. Rewritten JARs keep their file names.

  • The transform forks the project's java, which must be 25+. The plugin resolves micronaut-aot-bytecode on demand (micronaut.classPathTransform.version overrides it), so it adds nothing to the plugin's own runtime class path.

  • mn:run, tests and native images keep the original class path.
  • Tests: a unit test for the forked launcher, and invoker ITs for the shaded JAR (it contains the generated lambda classes), mn:dockerfile and mn:docker. Docs: a new "Rewriting the packaged class path" section in the packaging guide.

    Not measured here: the start-up gains are in the AOT PRs.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_011mLVeUnH4F6URVapfuGbKk

    Diff: 1963 lines (+1918 / -45) across 42 files Reviewer: graemerocher Review duration: 39343m
    All Vouch review confidence checks passed
    Residual risk 0.34 = Change Risk (0.72) × (1 − Review Confidence (0.53)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 1963 lines diff across 42 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    52%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Shallow Review Depth shallow_review_depth
    0.289
    Mass File Touch mass_file_touch
    0.080
    Reviewers
    Assignees
    alvarosanchez alvarosanchez
    Labels
    risk: low confidence: 52.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 52.9% · Lower = rushed or shallow review
    52.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33.7% · Safe to merge
    33.7%