Class MavenSettingsAdapter

java.lang.Object
network.ike.plugin.scaffold.MavenSettingsAdapter
All Implemented Interfaces:
ModelAdapter

public final class MavenSettingsAdapter extends Object implements ModelAdapter
Model adapter for ~/.m2/settings.xml (Maven Settings 1.2.0).

Supported ensure subtree:

ensure:
  pluginGroups:
    - network.ike.tooling

Semantics:

  • If the file does not exist, a minimal <settings xmlns="..."> document is created.
  • Each pluginGroup in ensure.pluginGroups that is not already present is appended. Existing entries — and any unrelated elements (servers, profiles, …) — are left untouched.
  • Each installed or re-confirmed pluginGroup is recorded as a ManagedElement with path "/settings/pluginGroups/pluginGroup[text()='G']".

DOM-based so unmanaged content (comments, whitespace outside the managed region, unrelated child elements) is preserved on round-trip to the extent the Transformer supports it.

  • Field Details

  • Constructor Details

    • MavenSettingsAdapter

      public MavenSettingsAdapter()
      Construct a stateless Maven-settings adapter. Instances are safe to share across planning calls; all per-invocation state lives on method parameters.
  • Method Details

    • modelName

      public String modelName()
      Description copied from interface: ModelAdapter
      Model name this adapter handles, matching ManifestEntry.model() (e.g. "maven-settings-4").
      Specified by:
      modelName in interface ModelAdapter
      Returns:
      the model name; never null
    • plan

      public ModelPlanResult plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion)
      Description copied from interface: ModelAdapter
      Plan a single model-managed entry.
      Specified by:
      plan in interface ModelAdapter
      Parameters:
      entry - the manifest entry; must have ScaffoldTier.MODEL_MANAGED tier and model() equal to ModelAdapter.modelName()
      resolvedDest - absolute destination path (placeholders already expanded)
      currentContent - bytes currently on disk at resolvedDest, or null if no file exists
      priorEntry - lockfile entry from the last publish, or null if never applied
      currentStandardsVersion - the standards-version of the current manifest; stamped on newly-installed elements so drift can be reasoned about later
      Returns:
      a ModelPlanResult with both a TierAction and the element-level provenance for the lockfile