Hiteshsai007 commented on PR #12744: URL: https://github.com/apache/maven/pull/12744#issuecomment-5283120551
### Addressed Review Feedback & Fixes Thanks for the feedback! I have pushed a new commit to address the review comments and resolve the integration test issues. Here is a summary of the changes: #### 1. Filter Out Non-Transitive Scope Dependencies As requested, the inline logic now intentionally filters out dependencies with non-transitive scopes (like `test` and `provided`) using `DefaultConsumerPomBuilder::hasDependencyScope`. This ensures that dependencies originating from inlined packaging-activated profiles do not inadvertently leak into the Consumer POM if they aren't meant for transitive consumption. #### 2. Handle Non-Flattened Consumer POM Generation Previously, when the `maven.consumer.pom.flatten` property was disabled (which is the default), the Consumer POM generation fell back to `transformPom()`, bypassing the new packaging-profile handling logic entirely. - I added a call to `inlinePackagingActivatedProfiles` directly inside `transformPom()` so that packaging activation is consistently resolved and stripped. This ensures that the generated POM can still be safely downgraded to `4.0.0` for backwards compatibility with Maven 3 consumers, even when flattening is skipped. #### 3. Drop Profiles with Non-Matching Packaging The logic was refined to explicitly drop profiles that have packaging activation criteria that *do not* match the project's current packaging. Since a consumer resolving the artifact will always see its fixed packaging (e.g., `jar`), a profile activated solely by a mismatched packaging (e.g., `war`) will never evaluate to true and is correctly discarded. #### 4. Expanded Test Coverage I've updated `ConsumerPomBuilderTest` and its corresponding `pom.xml` to fully validate these scenarios: - The integration test explicitly sets `maven.consumer.pom.flatten=true` in the `MavenExecutionRequest` session to force the full interpolation and flattening pipeline. - It asserts that `test`-scoped dependencies (e.g., `slf4j-simple`) from matching profiles are stripped. - It asserts that profiles with non-matching packaging conditions are completely dropped from the final Consumer POM. - It asserts that "mixed-activation" profiles retain their non-packaging conditions while properly stripping the `<packaging>` field. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
