If you are working over a longer time with Maven your pom´s become larger and in particular in projects it happens that everyone has it´s own belief of how a good pom style should look like. Packaging type before artifactId, groupId and version, modules before any other things or after all other things etc. Sounds familiar?
Using a coding style guide in the Java development is usually today no big deal anymore. So why not doing the same in Maven POM files? You know the things? Curly bracket on the same line or better on a new line and such things.
You think this is only achievable manually? Fortunately not. There is a plugin which exactly fulfills this requirement.
The Maven-SortPom-Plugin can help you in such situations to make your life easier.
You can use the following
to sort your pom file in your current project. This call will use a default style which is used to define the order of the different elements with in the pom file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
In other words the above file will define to order your parent element in the way having the artifactId before the groupId and version whereas the groupId, artifactId and version of the current project is behind that parent.
But i would prever having the Maven coordinates always ordered the same way which mean that i would expecting having the groupId, artifactId and version also in the parent. So the solution to achieve this is simply create a local copy of the above file and change the order in the parent element accordingly.
So this can help to order the elements within your pom´s always in the same order.