Skip to content

Keep parent in flatten-bom configuration #37

Description

@vy

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.

Activity

  1. added this to the 10.2.0 milestone on Oct 3, 2023
  2. self-assigned this
    on Oct 4, 2023
  3. vy commented on Oct 4, 2023

    @vy
    MemberAuthor

    Fixed in 041768f.

  4. vy commented on Oct 7, 2024

    @vy
    MemberAuthor

    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions