Configure Maven To Use Different JDK For Different J2SE Versions?
25-05-2014
we solved this problem by explicitly sepecify the javac in config of compile plugin (with JAVA_HOME_6 and JAVA_HOME_7 defined as environment variables):
Java 6 module
Java 7 module
Java 6 module
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.6</source> <target>1.6</target> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <executable>${env.JAVA_HOME_6}/bin/javac</executable> <fork>true</fork> </configuration> </plugin>
Java 7 module
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <executable>${env.JAVA_HOME_7}/bin/javac</executable> <fork>true</fork> </configuration> </plugin>