Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Oct 9, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Questions ?

Please refer to the Backport tool documentation

…e#11228)

This commit fixes issue apache#11135 where dependencies with missing groupId
but present version were not having their groupId inferred from the
project groupId in Maven 4.1.0 model version.

The issue was that the groupId inference logic was only triggered when
both groupId and version were missing (in the inferDependencyVersion
method). However, the issue described cases where dependencies had
versions but missing groupIds.

Changes made:
1. Modified transformFileToRaw method in DefaultModelBuilder to handle
   missing groupId cases separately from missing version cases
2. Added new inferDependencyGroupId method that specifically handles
   groupId inference when version is present
3. Added unit test to verify the fix works correctly

The fix ensures that for Maven 4.1.0 model version, dependencies with
missing groupId will have their groupId inferred from the project
groupId, regardless of whether the version is present or not.

Fixes apache#11135

(cherry picked from commit d4336c6)
@gnodet gnodet added bug Something isn't working backport labels Oct 9, 2025
@gnodet gnodet merged commit 7494b88 into apache:maven-4.0.x Oct 9, 2025
19 checks passed
@github-actions github-actions bot added this to the 4.0.0 milestone Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant