I would like to use java 7 in my tests and java 6 for the code. How to achieve this?
You can also set source and target in the execution phase testCompile
of the maven-compiler-plugin
. So try something like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>testCompileWithJDK7</id>
<phase>test-compile</phase>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</execution>
</executions>
</plugin>