Skip to content

Keep parent in flatten-bom configuration #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vy opened this issue Oct 3, 2023 · 2 comments
Closed

Keep parent in flatten-bom configuration #37

vy opened this issue Oct 3, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@vy
Copy link
Member

vy commented Oct 3, 2023

flatten-bom configuration of flatten-maven-plugin doesn't keep the parent. This causes build failures for artifacts whose dependencies need to be resolved at runtime. Consider the following problem experienced in log4j-changelog-maven-plugin:

  1. log4j-changelog-maven-plugin depends on log4j-changelog
  2. log4j-changelog inherits from log4j-tools-parent
  3. log4j-tools-parent inherits from log4j-tools-bom
  4. log4j-tools-bom inherits from logging-parent
  5. logging-parent contains dependencyManagement, etc. entries that are used by log4j-changelog-maven-plugin
  6. Dependencies of log4j-changelog-maven-plugin et al. is resolved at runtime
  7. Though at runtime, the deployed log4j-tools-bom is used, which is flattened and hence doesn't have a parent!
  8. Hence, at runtime, log4j-transform-maven-plugin execution fails due to missing logic that should have been inherited from logging-parent

To avoid this, flatten-bom configuration should better keep the parent using <parent>keep</parent> in pomElements block.

@vy vy added the bug label Oct 3, 2023
@vy vy added this to the 10.2.0 milestone Oct 3, 2023
@vy vy self-assigned this Oct 4, 2023
vy added a commit that referenced this issue Oct 4, 2023
@vy
Copy link
Member Author

vy commented Oct 4, 2023

Fixed in 041768f.

@vy
Copy link
Member Author

vy commented Oct 7, 2024

Reproduction of the issue:

$ git clone https://github.com/apache/logging-log4j-tools.git && cd $_
$ git checkout 18425d95a4d150de905929d55bf55545d70f3d91
$ ./mvnw -N log4j-changelog:export@export-changelog -X
...
[INFO] --- log4j-changelog:0.5.0:export (export-changelog) @ log4j-tools-bom ---
[WARNING] The POM for org.apache.logging.log4j:log4j-changelog:jar:0.5.0 is invalid, transitive dependencies (if any) will not be available: 2 problems were encountered while building the effective model for org.apache.logging.log4j:log4j-changelog:0.5.0
[ERROR] 'dependencies.dependency.version' for org.osgi:osgi.annotation:jar is missing. @ 
[ERROR] 'dependencies.dependency.version' for com.github.spotbugs:spotbugs-annotations:jar is missing. @

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant