Maven plugin that helps the user sort pom.xml.
Maven plugin that helps the user sort pom.xml by formatting the XML and organizing XML sections in a predefined order. The main advantages to have standardized sorted poms are that they become more readable and that comparisons between different module poms becomes much easier.
The SortPom Plugin has two goals.
mvn sortpom:sort sorts the current pom.xml file. This goal will always sort the pom.xml file.
mvn sortpom:verify only sorts the current pom.xml file if the xml elements are unsorted. This goal ignores text formatting (such as indentation and line breaks) when it verifies if the pom is sorted or not.
The Sortpom plugin will reorder the pom elements and format the xml structure in the pom-file. The plugin can be configured to sort by different standards or by a custom format. A backup file will be created by default, so that you can check how the pom-file has changed.
Sortpom works best if it is run every time during Maven compilation. Configure it once and then forget about it. Replace the plugin version with the latest one:
<build>
<plugins>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<goals>
<goal>sort</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
If you just want to perform a simple test what the plugin does then open a command prompt in your project home and enter
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:3.3.0:sort -Dsort.predefinedSortOrder=custom_1
Detailed example of how the plugin can be configured to run every time you build your project; see recommended configuration wiki page
The plugin will not change how your Maven project is compiled (Exception)
Added
https://github.com/Ekryd/sortpom/wiki/Versions
https://github.com/Ekryd/sortpom/wiki/Parameters
The plugin is hosted i Maven Central and will be downloaded automatically if you include it as a plugin in your pom file.
If you use it, then please consider some encouragement. ⭐️ Star it in GitHub!