-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support ordering of dependencies #181
Comments
Is this a way to keep the original order for you? Or do you use this to order them only in the flattened pom? |
This is a way to order only in the flattened pom |
Not sure how necessary this is then. I would recommend keeping them in order in the original pom and flatten plugin could enforce the source ordering. |
So I checked and the order of dependencies matters for transitive dependencies. (https://stackoverflow.com/questions/31740785/why-order-of-maven-dependencies-matter/31743617#31743617) So I would say that the order needs to stay the same. I think it already does even though I could not find a proper test for it (https://github.com/mojohaus/flatten-maven-plugin/tree/master/src/it/projects) Because ordering can change the behaviour of the pom, I would not merge this. |
@lasselindqvist The Maven resolution algorithm resolves transient dependencies' versions based on the root proximity of the pom.xml dependency tree. That's why the original pom should NEVER order dependencies, but when talking about flattened poms (which all dependencies are in the same level) the order doesn't really matter. |
It uses the distance to decide the candidates, but if two transitive dependencies have the same distance, it takes the one that it first. |
I am probably missing something, but how can you have transitive dependencies in a flattened pom? Anyway, feel free to close this PR and the issue if you think it doesn't make sense. Thanks for the feedback! |
http://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html#flattenDependencyMode Now, I don't want to reject it just yet, because it might make sense to merge it, have it off by default (as it is in the open PR) and have a clear warning in the documentation about the risk of using it. I'd like to leave this issue open for a while to see if some third person has opinion or arguments for or against. |
I agree, sorting is not just about affecting the final decision on Maven dependencies; from a learning, reading, and management perspective, I would like to keep the order of tags within the POM file after flattening. Additionally, I found that even with the "keepCommentsInPom" feature enabled, multi-level comment structures are flattened and destroyed. |
After the pom.xml's dependencies are flattened, it would be nice if the plugin allowed you to order the dependencies (to make it easier to read).
The text was updated successfully, but these errors were encountered: