I have a Maven project with both server back-end modules and client front-end modules. The goal is to take advantage of performance improvements in JDK 7 for the server back-end modules but build the client modules in JDK 6 only. The client modules run in Tomcat while the server modules are separate Java applications.
I am aware of the Maven configuration to target specific JDK:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerVersion>1.6</compilerVersion>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
One caveat to this approach is that there are common modules that are used by both the server modules and client modules necessitating two different binaries (JDK 6 and 7) for each module.
How can one compile one set of artifacts for a JDK 6, and another set of artifacts for JDK 7, and a third set of artifacts (used by both) for both JDK 6 and 7 all belonging to the same project? Would it be necessary to divide the modules up into three separate projects?