This project provides an XML schema (XSD) to validate POMs to enforce a strict order of the elements.
Please refer to the outline for an overview over the order of elements enforced by this schema.
Add http://maven.apache.org/maven-v4_0_0.xsd as key for the schema location to validate POM files within your IDE (e.g. Eclipse). No changes are required to the pom.xml.
You may want this configuration with the Maven-SortPom-Plugin like this:
<plugin> <groupId>com.google.code.sortpom</groupId> <artifactId>maven-sortpom-plugin</artifactId> <version>2.0.0</version> <dependencies> <dependency> <groupId>de.smartics.config</groupId> <artifactId>maven-strict-pom</artifactId> <version>1.1.3</version> </dependency> </dependencies> <configuration> <expandEmptyElements>false</expandEmptyElements> <keepBlankLines>true</keepBlankLines> <createBackupFile>true</createBackupFile> <sortOrderFile>strict-pom.xml</sortOrderFile> </configuration> </plugin>