Class BomAnalysis

java.lang.Object
network.ike.workspace.BomAnalysis

public final class BomAnalysis extends Object
Analyzes BOM imports in workspace subproject POMs to detect version cascade gaps and support feature-start BOM updates.

Key concepts:

  • Workspace-internal BOM: a BOM (pom import) whose groupId:artifactId is in the published artifact set of a workspace subproject
  • External BOM: a BOM not published by any workspace subproject
  • Cascade gap: when subproject A depends on subproject B, but A has neither a version-property nor a workspace-internal BOM import that tracks B's version. A workspace BOM tracks B when it is B's own BOM, or when its <dependencyManagement> manages one of B's published artifacts (ike-issues#794)
  • External pin: an external BOM manages artifacts published by a workspace subproject, potentially overriding the workspace version
  • Method Details

    • extractBomImports

      public static List<BomAnalysis.BomImport> extractBomImports(Path pomFile, Map<String, Set<PublishedArtifactSet.Artifact>> workspaceArtifacts) throws IOException
      Extract all BOM imports from a subproject's root POM's <dependencyManagement> section.
      Parameters:
      pomFile - the root POM to analyze
      workspaceArtifacts - map of workspace subproject name to its published artifact set
      Returns:
      list of BOM imports in declaration order
      Throws:
      IOException - if the POM cannot be read or parsed
    • analyzeCascadeIssues

      public static List<BomAnalysis.CascadeIssue> analyzeCascadeIssues(Path wsDir, Manifest manifest, Map<String, Set<PublishedArtifactSet.Artifact>> workspaceArtifacts) throws IOException
      Analyze cascade issues for all subprojects in the workspace.
      Parameters:
      wsDir - workspace root directory
      manifest - the workspace manifest
      workspaceArtifacts - published artifacts per subproject
      Returns:
      list of cascade issues (empty if all edges can cascade)
      Throws:
      IOException - if a subproject POM cannot be read
    • extractManagedArtifacts

      public static Set<PublishedArtifactSet.Artifact> extractManagedArtifacts(Path bomPom) throws IOException
      Extract the set of artifact coordinates managed by a BOM POM's <dependencyManagement> section.

      Returns every groupId:artifactId pair declared under <dependencyManagement><dependencies>, with ${property} references in the groupId and artifactId resolved against the POM's own <properties>. Versions are ignored — this set answers "which artifacts does this BOM govern", not "at what version".

      Nested BOM imports (a <dependency> with <type>pom</type> and <scope>import</scope>) are reported as their own coordinate but are NOT transitively expanded into the artifacts they manage. See the IKE-Network/ike-issues#794 follow-up for transitive resolution.

      Parameters:
      bomPom - the BOM POM file to read
      Returns:
      the managed groupId:artifactId set; empty if the file is absent, unparseable, or declares no <dependencyManagement>
      Throws:
      IOException - if the POM cannot be read
    • updateBomImportVersion

      public static boolean updateBomImportVersion(Path pomFile, String groupId, String artifactId, String newVersion) throws IOException
      Update a BOM import version in a POM file. Finds the <dependency> block in <dependencyManagement> with matching groupId:artifactId and type=pom/scope=import, and rewrites its <version> element.
      Parameters:
      pomFile - the POM to modify
      groupId - BOM groupId to match
      artifactId - BOM artifactId to match
      newVersion - the new version to set
      Returns:
      true if the file was modified
      Throws:
      IOException - if the POM cannot be read or written