Sunday, July 15, 2007

Choose Java Version for Maven compile

It is possible to set the version of the jdk one wants to use when compiling code using maven.

This might be mandatory if your code uses generics or annotations. So here is the code you should add to your pom.xml.


<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>
...

No comments: