[MSHADE-419] Restore project.getFile() after dependency-reduced POM creation when shadedArtifactAttached=true - #828
Open
elharo wants to merge 1 commit into
Open
[MSHADE-419] Restore project.getFile() after dependency-reduced POM creation when shadedArtifactAttached=true#828elharo wants to merge 1 commit into
elharo wants to merge 1 commit into
Conversation
…reation When shadedArtifactAttached=true, the original artifact remains the main artifact and its POM comes from project.getFile(). If project.getFile() points to the dependency-reduced POM (which has compile dependencies removed), then install/deploy will use the reduced POM instead of the original one, causing downstream projects to lose transitive compile dependencies. Save and restore the original project file around DRP creation to ensure the correct POM is used for the main artifact. Includes integration test MSHADE-419_attachedDepPom that verifies project.file still points to the original pom.xml after shading with shadedArtifactAttached=true.
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.
Problem
When
shadedArtifactAttached=true, the original (non-shaded) artifact remains the main artifact of the project. The POM used for this main artifact comes fromproject.getFile(). AftercreateDependencyReducedPom()callsproject.setFile(dependencyReducedPomLocation),project.getFile()points to the dependency-reduced POM instead of the originalpom.xml.This causes
maven-install-pluginandmaven-deploy-pluginto use the dependency-reduced POM (which has compile dependencies removed) as the project's POM. Downstream projects depending on the library lose transitive compile dependencies.Introduced/changed by MSHADE-321 (commit 6ea8543). The issue manifests specifically when:
shadedArtifactAttached=true(so the original artifact is retained)createDependencyReducedPom=true(default)Fix
Save
project.getFile()before callingcreateDependencyReducedPom()and restore it afterward inShadeMojo.execute(). This ensuresproject.getFile()continues to point to the originalpom.xml, so install/deploy use the correct POM with all compile dependencies.Integration Test
MSHADE-419_attachedDepPom: Configures shade withshadedArtifactAttached=trueanddependencyReducedPomLocationintarget/, then verifies viamaven-help-plugin:evaluatethat${project.file}still points to the originalpom.xmlafter shading.dependency-reduced-pom.xml)pom.xml)All 72 unit tests pass.
Fixes #711