Class AlignmentReconciler

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

public class AlignmentReconciler extends Object implements Reconciler
Reconciler that aligns inter-subproject dependency, plugin, and parent versions across every cloned subproject's POMs to the authoritative versions declared by the workspace.

Subsumes the ws:align-{draft,publish} business logic (IKE-Network/ike-issues#393). Unlike most other reconciler migrations, the standalone ws:align-draft and ws:align-publish Maven goals are retained as thin wrappers over this reconciler: alignment drift arises from many distinct moments (post-release cascade, manual POM edits, feature work, scaffold drift), so the reconciler is also invoked from ws:scaffold-publish as part of the convergence pass. The standalone goals remain as the explicit "I detected misalignment, run only that" entry point.

What this reconciler aligns

  1. Dependency versions — for each POM, when a <dependency> references another workspace subproject's artifact (groupId:artifactId matches the artifact set published by that subproject), the declared version is updated to match the subproject's current POM version. Property-based versions (${ike-bom.version}) update the property; direct <version> tags rewrite in place.
  2. Plugin versions — same matching for <plugin> declarations. Property-based plugin versions are deferred to the dependency/property alignment pass above.
  3. Parent versions — when a subproject declares another subproject as its parent (via the manifest parent: field), and the parent subproject's version differs from the child's <parent><version>, the child POM (and any submodule POMs referencing the same parent GAV) is updated. This is distinct from ParentVersionReconciler, which cascades the workspace root POM's parent across subprojects.

Reads use Maven 4's PomModel (Model API, no regex). Writes go through PomModel's OpenRewrite-LST-backed updaters — see feedback_no_sed_on_poms.

Opt out with -DupdateAlignment=false.

  • Constructor Details

    • AlignmentReconciler

      public AlignmentReconciler()
  • 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