Monday, July 23, 2012

Sorting your pom.xml

When you are using Maven, it's better to sort your pom.xml based on Maven pom.xml reference.
There's an useful plugin for that.

Put the plugin on your pom.xml, inside build element.

<build>

 <plugins>
      <plugin>
        <groupId>com.google.code.sortpom</groupId>
        <artifactId>maven-sortpom-plugin</artifactId>
        <version>1.3.1</version>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>sort</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
</plugins>
</build>


Then run mvn sortpom:sort