For some reason Maven 2 does not have JDK 1.5 set as its default compiler level. Since I’ve run into this problem a few times, I figured I would document the solution.
This will need to be added to the root POM of your Maven project:
<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>
</plugins>
</build>
You can also add this into an “active by default” profile in your settings.xml, located in either your .m2 directory or your install directory.
Marcos said
Thank you very much, it helped me a lot!
scipper said
helped me too! thx