Usage
The following examples describe the basic usage of the Tidy Plugin.
Format the POM
To format the pom.xml execute the pom goal manually.
mvn tidy:pom
The pom.xml file will
- be rewritten according to the POM Code Convention of the Maven team.
- have the nodes
groupId,artifactIdandversionalways in this order.
Note: By default only the children of the sorted sections are indented, and they keep the indentation the pom.xml already has. Set enforceIndent to true (or run with -Dtidy.enforceIndent=true) to indent every line with two spaces per level, and a line that continues a tag, such as a wrapped attribute, with four spaces more than the tag. The text of an element, comments and CDATA sections keep their lines as they are.
Note: The following sections can have their child elements reordered without affecting the build:
/project/licenses/project/developers/project/contributors/project/mailingLists/project/properties/project/build/pluginManagement/plugins/project/profiles
Note: The following sections potentially can affect the build process if the child elements are reordered:
/project/repositories/project/pluginRepositories/project/dependencyManagement/dependencies/project/dependencies/project/build/plugins
Checking for Tidy POM as Part of the Build
If you want to fail the build for a POM that is not formatted according to the pom goal, you must add an execution of tidy:check to the build element.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tidy-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>


