As seen in the screenshot the module/project are set to jdk 1.7
Project / sdk set to 7:
Module set to jdk 7:
However from javap we are seeing java6 (50) ??
a) Confirm the class were just now compiled (7/22/15 @18:14) :
ls -l ./target/classes/org/yardstickframework/spark/DataGenerator.class
-rw-r--r-- 1 steve staff 3829 Jul 22 18:14 ./target/classes/org/yardstickframework/spark/DataGenerator.class
b) Which version of java?
javap -verbose ./target/classes/org/yardstickframework/spark/DataGenerator.class | grep ver
minor version: 0
major version: 50
Note: The pom.xml sets language level to jdk7
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Update Per a suggestion I ran the compilation from command line :
mvn clean compile
This results also in jdk6 /major version=50. Now why would that be? I am examining the POM to see if other weirdness present.
Another update Per Roman's request: here is maven output
$mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 08:22:22-0700)
Maven home: /usr/local/Cellar/maven/3.1.1/libexec
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10", arch: "x86_64", family: "mac"
Yet another update ElliottFrisch suggested some additions to the maven compiler plugin. Here is the updated section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<verbose>true</verbose>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
OK I am a bit sheepish on this. This is a scala project and the class files are outputs from the scala-maven plugin. So all those maven-compiler settings only apply to java source files. Sorry about that huge missing factoid folks.
The means to get the proper version within the scala-maven-plugin is not straightforward to determine: but luckily someone has figured it out:
http://xflin.blogspot.com/2013/08/mixed-scala-and-java-in-maven-project.html
Here is the key piece:
<recompileMode>incremental</recompileMode>
<args>
<arg>-target:jvm-1.7</arg>
</args>
<javacArgs>
<javacArg>-source</javacArg><javacArg>1.7</javacArg>
<javacArg>-target</javacArg><javacArg>1.7</javacArg>
</javacArgs>
That goes within the normal scala-maven-plugin section which looks like:
<plugin>
<version>3.2.1</version>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaCompatVersion>${scala.version}</scalaCompatVersion>
<scalaVersion>${scala.binary.version}</scalaVersion>
<jvmArgs>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<recompileMode>incremental</recompileMode>
<args>
<arg>-target:jvm-1.7</arg>
</args>
<javacArgs>
<javacArg>-source</javacArg><javacArg>1.7</javacArg>
<javacArg>-target</javacArg><javacArg>1.7</javacArg>
</javacArgs>
</configuration>
</plugin>
After adding that piece to the scala plugin we now have:
$javap -verbose ./target/classes/org/yardstickframework/spark/DataGenerator.class | grep ver
minor version: 0
major version: 51