Class MavenWrapperReconciler

java.lang.Object
network.ike.plugin.ws.reconcile.MavenWrapperReconciler
All Implemented Interfaces:
Reconciler

public class MavenWrapperReconciler extends Object implements Reconciler
Reconciler that keeps each subproject's Maven wrapper pinned to the workspace's declared Maven version (IKE-Network/ike-issues#701).

workspace.yaml declares defaults.maven-version (e.g. 4.0.0-rc-5); a subproject may override it with its own maven-version. Nothing previously enforced that a subproject's .mvn/wrapper/maven-wrapper.properties actually matches. A subproject onboarded with an older wrapper (e.g. tinkar-schema carrying Maven 3.9.11) silently stayed pinned to the wrong version, and ws:scaffold-draft/-publish then failed because the workspace enforcer requires Maven 4+.

This reconciler closes that gap: it reads the pinned version from each subproject's wrapper, compares it against the expected version (subproject override, else defaults.maven-version), reports drift in draft mode, and rewrites the distributionUrl (and the legacy maven.version key, when present) in publish mode.

Scope is the version only — ScaffoldConventionReconciler owns wrapper presence (regenerating missing files and replacing the legacy custom launcher), but only for the workspace root and only when files are absent or legacy; it never re-pins the version of a well-formed subproject wrapper. The two reconcilers are complementary.

Subprojects without a wrapper file are skipped (no presence enforcement here). Idempotent: a second run is a no-op. Opt out with -DupdateWrapper=false.

See Also:
  • Constructor Details

    • MavenWrapperReconciler

      public MavenWrapperReconciler()
      Creates the reconciler.
  • Method Details

    • dimension

      public String dimension()
      Description copied from interface: Reconciler
      Human-readable name of the dimension this reconciler owns. Used as the heading in scaffold-draft output.
      Specified by:
      dimension in interface Reconciler
      Returns:
      the dimension label, e.g. "Denormalized YAML fields"
    • optOutFlag

      public String optOutFlag()
      Description copied from interface: Reconciler
      The Maven property name (without the -D prefix) that opts out of this reconciler's apply pass. Setting the property to "false" skips this dimension on a given scaffold-publish invocation.
      Specified by:
      optOutFlag in interface Reconciler
      Returns:
      the opt-out flag name, e.g. "updateFields"
    • detect

      public DriftReport detect(WorkspaceContext ctx)
      Description copied from interface: Reconciler
      Inspect the workspace and report any drift this reconciler would correct. Read-only — must not mutate the workspace.
      Specified by:
      detect in interface Reconciler
      Parameters:
      ctx - the workspace context
      Returns:
      drift report; DriftReport.noDrift(String) if nothing to do
    • apply

      public void apply(WorkspaceContext ctx)
      Description copied from interface: Reconciler
      Apply reconciliation. Caller is responsible for checking ReconcilerOptions.isOptedOut(String) before invoking; implementations may also re-check defensively.
      Specified by:
      apply in interface Reconciler
      Parameters:
      ctx - the workspace context