Example

Below you find a complete POM that performs formatting after each compile run finished successfully, disables logging of Javadoc related messages, only displays messages with warning severity or higher, activates the profile “test” during formatting and imports the code convention jalopy.xml from the build-config artifact. Formatting is applied to all Java source files of the project that are not located below the “testdata” folder.

Example 11.1. Maven POM

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>testing</groupId>
  <artifactId>test</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Quick Start Archetype</name>
  <url>http://maven.apache.org</url>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>triemax</groupId>
        <artifactId>jalopy-maven</artifactId>
        <configuration>
          <javadoc>false</javadoc>
          <logLevel>warn</logLevel>
          <convention>classpath:jalopy.xml</convention>
          <sources>
            <source>/work/foo/main/src/java</source>
            <source>/work/foo/test/src/java</source>
          </sources>
          <includes>
            <include>**/*.java</include>
          </includes>
          <excludes>
            <exclude>**/testdata/**</exclude>
          </excludes>
          <environment>
            <lead>John Doo</lead>
            <office>Alta Nova</office>
          </environment>
        </configuration>
        <dependencies>
          <!-- Import the artifact that provides the code convention -->
          <dependency>
            <groupId>com.mycompany</groupId>
            <artifactId>build-config</artifactId>
            <version>1.0.2</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>format</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>