Skip to content

[Bug]: Maven POM ingestion drops most inter-module depends_on edges: inherited groupId and ${...} properties are not resolved #3806

Closed

Description

@afsantamaria-stratio

What happened?

Summary

_parse_pom (graphify/manifest_ingest.py) builds each module's package id and each
dependency's id from the literal text of the POM. Two common Maven patterns make those ids
disagree, so the depends_on edge points at a node that doesn't exist and is pruned as dangling
by build_from_json:

  1. Inherited groupId. A module that takes its groupId from <parent> — the norm in a
    multi-module reactor — gets the bare id artifactId, because root.findtext("groupId") only
    reads the module's own top-level element:

    gid = root.findtext("groupId")          # None when inherited from <parent>
    name = f"{gid}:{aid}" if gid else aid   # -> "livy-server", not "org.apache.livy:livy-server"

    Dependencies on it always carry a groupId (Maven requires it), so they are emitted as
    org.apache.livy:livy-server and never match. Such a module can never be the target of an
    edge.

  2. Unresolved properties. ${project.groupId}, ${scala.binary.version} and any other
    property are kept verbatim in dependency coordinates (${project.groupId}:livy-rsc,
    livy-core_${scala.binary.version}), while the target module's own id is written out
    (org.apache.livy:livy-rsc). No match, no edge.

The failure is silent: nodes for every module are created, only the edges are missing.

Steps to reproduce

apache/livy` (21 modules) shows both causes in one file.

  
  git clone --depth 1 https://github.com/apache/livy.git
  cd livy && graphify update .
  graphify explain "livy-server"
  

  `server/pom.xml` declares four internal dependencies; the graph keeps one:

  | Dependency | `groupId` | `artifactId` | Target's own id | Edge |
  |---|---|---|---|---|
  | `livy-test-lib` | `org.apache.livy` | `livy-test-lib` | `org.apache.livy:livy-test-lib` | ✅ |
  | `livy-rsc` | `${project.groupId}` | `livy-rsc` | `org.apache.livy:livy-rsc` | ❌ (2) |
  | `livy-core` | `${project.groupId}` | `livy-core_${scala.binary.version}` | `livy-core-parent` / `livy-core_2.12` | ❌ (1, 2) |
  | `livy-repl` | `org.apache.livy` | `livy-repl_${scala.binary.version}` | `livy-repl-parent` / `livy-repl_2.12` | ❌ (1, 2) |

  Across the repo:

  - The POMs declare **55** inter-module dependencies; the graph contains **18** `depends_on`
    edges between modules.
  - 8 of the 25 module nodes inherit their groupId (`livy-server`, `livy-core-parent`,
    `livy-repl-parent`, `livy-scala-api-parent`, `livy-integration-test`, `livy-assembly`,
    `livy-beeline`, `livy-coverage-report`). **None of the 18 edges targets any of them.**
  - Asked "which modules depend on `livy-core`?", the graph answers none; the POMs list 8.

Error output or graph output

Inter-module dependencies resolve to their module nodes, as they would under Maven's own effective-POM rules.

Graphify version

0.9.67

Environment

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions