Skip to content

Proposal: add codes to parse the <version> for the dependency in profile which is managed by <dependencyManagement> when the <activation> is <jdk> or <os> #148

Open
@yangnuoyu

Description

@yangnuoyu

Problem:
Connecting to the question #145 , we cannot fetch dependency versions in when it is managed by dependencyManagement in the parent pom. I notice that there is a embedBuildProfileDependencies configuration which is mentioned in #138 . When we set it as true, the plugin will parse the profile but just works when activation is not "jdk" or "os". So it is still a problem when we want to use either of them. The key problem is that, when dealing with profile in a pom, the flatten-maven-plugin just copies the profile to effectivePom but not parse it.

Proposal:
Add a piece of code to parse the version of the dependencies in profile after creating the effectivePom which will be used in most of the flatten modes.

I personally use a straightforward method to solve the problem: when effectivePom is created, it has both dependencyManagement part and profile part. I write a code to go through both of their dependencies to find matches, if so, I will copy the version from dependencyManagement to the dependency in profile if it does not have a version.

I have tested it in different flatten modes and it always works, but I think it will be more stable if we can use existing functions in Java Maven.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions