Summary
Make PomEditor.Dependencies.findManagedVersion(Coordinates) public so callers can check whether a dependency is already locally managed before performing mutations.
Use case
When adding a transitive dependency with addAligned using VersionStyle.MANAGED, the method always creates a local <dependencyManagement> entry — even when the dependency is already managed by a parent POM. This causes unwanted local managed entries that shadow the parent's management.
Callers need to check whether a managed entry already exists locally before calling addAligned, so they can skip or clean up the redundant local entry. Currently the only way is manual DOM navigation:
boolean hadManagedEntry = editor.document().root()
.childElement("dependencyManagement")
.flatMap(dm -> dm.childElement("dependencies"))
.flatMap(deps -> deps.childElements("dependency")
.filter(coords.predicateGATC())
.findFirst())
.isPresent();
Proposed API
Make the existing private method public:
public String findManagedVersion(Coordinates coords)
Returns the managed version string if found locally, or null if not.
Alternatively, a boolean hasManagedDependency(Coordinates) convenience method would also work.
Claude Code on behalf of Guillaume Nodet
Summary
Make
PomEditor.Dependencies.findManagedVersion(Coordinates)public so callers can check whether a dependency is already locally managed before performing mutations.Use case
When adding a transitive dependency with
addAlignedusingVersionStyle.MANAGED, the method always creates a local<dependencyManagement>entry — even when the dependency is already managed by a parent POM. This causes unwanted local managed entries that shadow the parent's management.Callers need to check whether a managed entry already exists locally before calling
addAligned, so they can skip or clean up the redundant local entry. Currently the only way is manual DOM navigation:Proposed API
Make the existing private method public:
Returns the managed version string if found locally, or
nullif not.Alternatively, a
boolean hasManagedDependency(Coordinates)convenience method would also work.Claude Code on behalf of Guillaume Nodet