Summary
Add a public method to PomEditor.Dependencies that adds or updates a managed dependency while following the project's detected conventions (property creation, naming convention).
Current behavior
updateManagedDependency(boolean upsert, Coordinates coordinates) always inlines the raw version string when creating a new managed dependency (e.g., <version>2.0.13</version>). It does not create a version property or follow the project's detected conventions.
The convention-aware logic exists internally (in addAligned / alignDependency paths via resolveConventions, upsertVersionProperty, resolvePropertyName), but there's no public equivalent for managed dependency operations.
Proposed API
Something like:
// Convention-aware: detects project style and creates properties if needed
public boolean updateManagedDependencyAligned(boolean upsert, Coordinates coordinates);
public boolean updateManagedDependencyAligned(boolean upsert, Coordinates coordinates, AlignOptions options);
This should:
- Detect project conventions via
resolveConventions(options)
- If
versionSource == PROPERTY: generate the property name, call upsertVersionProperty, and use ${propName} as the version
- Call
updateManagedDependency with the (possibly property-ref) version
Workaround
Users can currently combine detectConventions() + AlignOptions.generatePropertyName() + properties().updateProperty() + updateManagedDependency() manually, but this duplicates internal logic and is error-prone.
Claude Code on behalf of Guillaume Nodet
Summary
Add a public method to
PomEditor.Dependenciesthat adds or updates a managed dependency while following the project's detected conventions (property creation, naming convention).Current behavior
updateManagedDependency(boolean upsert, Coordinates coordinates)always inlines the raw version string when creating a new managed dependency (e.g.,<version>2.0.13</version>). It does not create a version property or follow the project's detected conventions.The convention-aware logic exists internally (in
addAligned/alignDependencypaths viaresolveConventions,upsertVersionProperty,resolvePropertyName), but there's no public equivalent for managed dependency operations.Proposed API
Something like:
This should:
resolveConventions(options)versionSource == PROPERTY: generate the property name, callupsertVersionProperty, and use${propName}as the versionupdateManagedDependencywith the (possibly property-ref) versionWorkaround
Users can currently combine
detectConventions()+AlignOptions.generatePropertyName()+properties().updateProperty()+updateManagedDependency()manually, but this duplicates internal logic and is error-prone.Claude Code on behalf of Guillaume Nodet