Closed YNedderhoff closed 1 year ago
Ok, after further investigation, it turns out that it does sort, it just happens to sort only the top level pom tags (dependencyManagement
, dependencies
, plugins
, ...). But on the lower level, i.e. dependency
, it doesn't. I think recommended_2008_06
used to though, no?
Hi! Beginning with 3.0.0, I made a few common parameters default (such as keeping empty lines). The older plugin contained a switch between the order of artefact and group name and that is perhaps why the file resorted in later versions. Do you still have a problem?
Is there a detailed changelog somewhere where I can see what has been changed?
My problem is a slightly different one though, I think at least? My problem is that dependencies within <dependencies>
and <dependencyManagement>
are not being sorted alphabetically anymore with the above config. With an older version, they were. The same for plugins.
That sounds weird. I don't have a more detailed changelog than the news: https://github.com/Ekryd/sortpom#news, unless you want to parse the code itself.
Can you post a complete example pom to show the problems in detail. That way I can run the same sorting to see what happens.
I may have an idea what is happening.
The <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
just says in which order elements should be placed, like dependencies before plugins.
In order to sort the order within the dependencies, you must specify that order with a parameter like <sortDependencies>scope,groupId,artifactId</sortDependencies>
(and same for sortPlugins
).
Hey, sorry I didn't get around to do that example, yet.
On your latter comment: That's interesting. Was this different before? Because I definitely remember my dependencies being sorted correctly before.
I think that the change to customized sorting for dependencies and plugin was was done in 2.1.0.
2012-09-23 | 2.1.0 | The parameters sortDependencies and sortPlugins are remade for greater flexibility.
If no sorting of dependencies is specified, the existing order of the dependencies is just kept. You would never get a randomized order.
@Ekryd @YNedderhoff I have the same issue. Its not sorting as well after upgrade
@Ekryd @YNedderhoff When I sort via terminal
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:3.2.0:sort -Dsort.sortDependencies=scope,groupId,artifactId -DsortProperties=true
but this doesn't sort
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:3.2.0:sort -Dsort.sortDependencies=groupId,artifactId -DsortProperties=true
I don't understand is scope
required
@atkawa7 scope means that SortPom sorts by scope first (i.e compile dependencies first and test dependencies last). Can you give me an example of the pom-file that you are sorting?
the existing order of the dependencies is just kept. You would never get a randomized order.
I think that's what I meant, yeah. But I feel like this behaviour wasn't the case before, was it?
Hey,
I have this config:
In a very much not sorted pom, when using
3.2.0
and runningmvn sortpom:sort
, it just saysPom file is already sorted, exiting
. Was there a breaking change that breaks my config?