Class MavenWrapperReconciler
- All Implemented Interfaces:
Reconciler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(WorkspaceContext ctx) Apply reconciliation.detect(WorkspaceContext ctx) Inspect the workspace and report any drift this reconciler would correct.Human-readable name of the dimension this reconciler owns.The Maven property name (without the-Dprefix) that opts out of this reconciler's apply pass.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Reconciler
pinFlag
-
Constructor Details
-
MavenWrapperReconciler
public MavenWrapperReconciler()Creates the reconciler.
-
-
Method Details
-
dimension
Description copied from interface:ReconcilerHuman-readable name of the dimension this reconciler owns. Used as the heading inscaffold-draftoutput.- Specified by:
dimensionin interfaceReconciler- Returns:
- the dimension label, e.g. "Denormalized YAML fields"
-
optOutFlag
Description copied from interface:ReconcilerThe Maven property name (without the-Dprefix) that opts out of this reconciler's apply pass. Setting the property to"false"skips this dimension on a givenscaffold-publishinvocation.- Specified by:
optOutFlagin interfaceReconciler- Returns:
- the opt-out flag name, e.g.
"updateFields"
-
detect
Description copied from interface:ReconcilerInspect the workspace and report any drift this reconciler would correct. Read-only — must not mutate the workspace.- Specified by:
detectin interfaceReconciler- Parameters:
ctx- the workspace context- Returns:
- drift report;
DriftReport.noDrift(String)if nothing to do
-
apply
Description copied from interface:ReconcilerApply reconciliation. Caller is responsible for checkingReconcilerOptions.isOptedOut(String)before invoking; implementations may also re-check defensively.- Specified by:
applyin interfaceReconciler- Parameters:
ctx- the workspace context
-