Record Class ReleaseContext

java.lang.Object
java.lang.Record
network.ike.plugin.release.ReleaseContext
Record Components:
gitRoot - the resolved git root for the project under release
mvnw - the resolved mvnw wrapper script; null until refined post-ReleasePrep via withMvnw(File)
log - the Maven plugin logger
request - the user-supplied release inputs

public record ReleaseContext(File gitRoot, File mvnw, org.apache.maven.api.plugin.Log log, ReleaseRequest request) extends Record
Per-invocation context carried through the release pipeline.

Bundles the resolved git root, Maven wrapper path, logger, and the ReleaseRequest (user-supplied inputs). Threaded through every release helper as a single parameter instead of positional gitRoot/mvnw arguments, so that downstream phase objects (FinalizePhase, NexusPhase, CentralPhase, ...) can be extracted with stable method signatures.

Two-stage construction: the context is built early in runGoal() with mvnw as null so that ReleasePrep (which doesn't need mvnw) can run against it. After mvnw is resolved, the mojo refines the context via withMvnw(File) before any phase that does need the Maven wrapper runs (logAudit, LocalPhase, NexusPhase, CentralPhase, ...). Phases that don't need mvnw must not dereference it; those that do are guaranteed to run only after refinement.

Carved out of ReleaseDraftMojo during the Phase 4 P2 prep commit (IKE-Network/ike-issues#489). Mutable per-invocation state (deploy attempt counts, async-spawn paths, etc.) lives on the NexusOutcome / CentralOutcome records on the mojo for now; a dedicated ReleaseRunState holder is introduced when the orchestrator lands.

  • Constructor Details

    • ReleaseContext

      public ReleaseContext(File gitRoot, File mvnw, org.apache.maven.api.plugin.Log log, ReleaseRequest request)
      Creates an instance of a ReleaseContext record class.
      Parameters:
      gitRoot - the value for the gitRoot record component
      mvnw - the value for the mvnw record component
      log - the value for the log record component
      request - the value for the request record component
  • Method Details

    • withMvnw

      public ReleaseContext withMvnw(File mvnw)
      Returns a copy of this context with mvnw replaced.

      Used to refine the early-built (mvnw == null) context once the wrapper is resolved.

      Parameters:
      mvnw - the resolved Maven wrapper script
      Returns:
      a new ReleaseContext with the same gitRoot, log, and request, and the given mvnw
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • gitRoot

      public File gitRoot()
      Returns the value of the gitRoot record component.
      Returns:
      the value of the gitRoot record component
    • mvnw

      public File mvnw()
      Returns the value of the mvnw record component.
      Returns:
      the value of the mvnw record component
    • log

      public org.apache.maven.api.plugin.Log log()
      Returns the value of the log record component.
      Returns:
      the value of the log record component
    • request

      public ReleaseRequest request()
      Returns the value of the request record component.
      Returns:
      the value of the request record component