Class PomModelAdapter
java.lang.Object
network.ike.plugin.scaffold.PomModelAdapter
- All Implemented Interfaces:
ModelAdapter
Model adapter for
pom.xml via OpenRewrite's XML LST.
POM writes always go through OpenRewrite (not regex, not the Maven 4 model API) so formatting, comments, and whitespace survive round-trips.
Supported ensure subtree:
ensure:
pluginManagement:
- groupId: network.ike.tooling
artifactId: ike-maven-plugin
version: 127-SNAPSHOT
Semantics:
- If the destination POM is missing, publish skips with an informational message — creating a POM from scratch is outside scaffold's responsibility.
- For each ensured plugin, the adapter checks whether a matching
<plugin>with the samegroupId + artifactIdexists anywhere under/project/build/pluginManagement/plugins. If absent it is appended (the wholepluginManagementscaffold is also created if missing). If present, the version is not changed — that is the job ofws:align-publish, not scaffold. - Each ensured plugin is recorded as a
ManagedElementwith path"/project/build/pluginManagement/plugins/plugin[groupId='G' and artifactId='A']".
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionModel name this adapter handles, matchingManifestEntry.model()(e.g.plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion) Plan a single model-managed entry.
-
Field Details
-
MODEL_NAME
-
-
Constructor Details
-
PomModelAdapter
public PomModelAdapter()Construct a stateless POM adapter. Instances are safe to share across planning calls; the underlying OpenRewrite parser is held in astatic finalfield.
-
-
Method Details
-
modelName
Description copied from interface:ModelAdapterModel name this adapter handles, matchingManifestEntry.model()(e.g."maven-settings-4").- Specified by:
modelNamein interfaceModelAdapter- Returns:
- the model name; never
null
-
plan
public ModelPlanResult plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion) Description copied from interface:ModelAdapterPlan a single model-managed entry.- Specified by:
planin interfaceModelAdapter- Parameters:
entry- the manifest entry; must haveScaffoldTier.MODEL_MANAGEDtier andmodel()equal toModelAdapter.modelName()resolvedDest- absolute destination path (placeholders already expanded)currentContent- bytes currently on disk atresolvedDest, ornullif no file existspriorEntry- lockfile entry from the last publish, ornullif never appliedcurrentStandardsVersion- thestandards-versionof the current manifest; stamped on newly-installed elements so drift can be reasoned about later- Returns:
- a
ModelPlanResultwith both aTierActionand the element-level provenance for the lockfile
-