Skip to content

Suggestion: Add a parameter to control the sort of dependencies in dependencymanagement #210

Closed

Description

@ssquan

If someone wants dependencies to be sorted first by scope in dependencies, but groupId in dependencyManagement, they will need a parameter independent of sortDependencies.
I would like to create a pull request for this.

Activity

  1. Ekryd commented on May 28, 2022

    @Ekryd
    Owner

    Interesting! What it the use case?
    Would it be some kind of sortDependencyManagements (or sortManagementDependencies) param that would take precedence if present and would fallback sortDependencies if not present?

    You are always welcome to create a PR. Be aware that I try to stay at 100% test coverage and I have an integration test for each parameter.

  2. self-assigned this
    on Jun 2, 2022
  3. ssquan commented on Jun 13, 2022

    @ssquan
    ContributorAuthor

    The common case is someone controls the version of dependency by BOMs but doesn't declare scope in the dependencyMangement section. In this case, dependencies in the dependencyMangement section should be sorted first by some element not socpe such as groupId since there is no scope at all.

    Declare scope in dependencyMangement is not a good practice. Here is a discussion in stackoverflow :https://stackoverflow.com/questions/15221299/dependencymanagement-and-scope

  4. Ekryd commented on Jun 15, 2022

    @Ekryd
    Owner

    Couldn't that be fixed by setting sort to scope, groupId, artifactId? If there is not scope, then the plugin wouldn't care about and just sort by the next listed sort criteria.

  5. Ekryd commented on Jul 13, 2022

    @Ekryd
    Owner

    I fixed the integration test and added a few test cases. Just discovered that we need this precise functionality; to sort all dependencies but not dependencyManagement all (due to bom conflicts).
    Our configuration will look like this:

                <sortDependencies>scope,groupId,artifactId</sortDependencies>
                <sortDependencyManagement>none</sortDependencyManagement>
    

    I'll try to merge it promptly

  6. Ekryd commented on Jul 14, 2022

    @Ekryd
    Owner

    The code should be in master now, please pull down the latest source code, compile it and try it out. You can set the version to 3.1.4-SNAPSHOT in your project temporarily.
    Tell me if it works for you

  7. Ekryd commented on Jul 17, 2022

    @Ekryd
    Owner

    New version 3.2.0 is released. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions