Skip to content
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

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

Closed
ssquan opened this issue May 28, 2022 · 7 comments
Assignees

Comments

@ssquan
Copy link
Contributor

ssquan commented May 28, 2022

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.

@Ekryd
Copy link
Owner

Ekryd commented May 28, 2022

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.

@create-issue-branch
Copy link

@ssquan
Copy link
Contributor Author

ssquan commented Jun 13, 2022

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

@Ekryd
Copy link
Owner

Ekryd commented Jun 15, 2022

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.

@Ekryd
Copy link
Owner

Ekryd commented Jul 13, 2022

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

@Ekryd
Copy link
Owner

Ekryd commented Jul 14, 2022

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

@Ekryd
Copy link
Owner

Ekryd commented Jul 17, 2022

New version 3.2.0 is released. Enjoy!

@Ekryd Ekryd closed this as completed Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants