How to set up your Maven2 POM to support Java5

Seeing this?
[bash highlight="3,4"]
$ mvn compile

generics are not supported in -source 1.3
(try -source 1.5 to enable generics)
[/bash]

You need to tell the maven-compiler-plugin to use java 1.5. Add this to your pom.xml:

<project>
...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>