[2.x] Fix #7951: Apply dependencyOverrides to delivered Ivy XML#8463
Merged
eed3si9n merged 4 commits intosbt:developfrom Jan 11, 2026
Merged
[2.x] Fix #7951: Apply dependencyOverrides to delivered Ivy XML#8463eed3si9n merged 4 commits intosbt:developfrom
eed3si9n merged 4 commits intosbt:developfrom
Conversation
Post-process the delivered Ivy XML file to apply dependency overrides. This is necessary because Ivy's deliver() method doesn't automatically apply DependencyDescriptorMediators when writing the XML. The fix: - Adds applyOverridesToDeliveredIvy() method in IvyActions - Reads the delivered Ivy XML and transforms dependency elements - Updates rev attributes for dependencies that have overrides - Ensures consistency between Maven POM and Ivy XML publishing Added unit tests to verify: - Overrides are correctly applied to matching dependencies - All other attributes are preserved - Non-matching dependencies remain unchanged
eed3si9n
reviewed
Jan 10, 2026
lm-ivy/src/test/scala/sbt/internal/librarymanagement/IvyActionsOverrideSpec.scala
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix dependencyOverrides not applied to Ivy XML
What's the problem?
When you use
dependencyOverridesin your build and then runpublishLocal, the generated Ivy XML file ignores your overrides. Instead of writing the actual version you specified, it writesrev="managed"- which is useless to anyone consuming your published artifact.For example, if you have:
The published
ivy.xmlwould contain:Instead of the expected:
This breaks downstream consumers who rely on the Ivy XML for dependency resolution.
Why does this happen?
Ivy's internal
deliver()method doesn't applyDependencyDescriptorMediators(which is how sbt implementsdependencyOverrides) when generating the XML output. The overrides work fine during resolution, but they're lost when writing the file.The fix
After Ivy generates the XML file, we now post-process it to apply the overrides. The fix:
<dependency>elementsrevattributeIt's a simple and targeted fix that doesn't change Ivy's internals - just patches up the output.
Testing
Added unit tests that verify:
Fixes #7951
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147