1
votes

I recently upgraded a Maven project to Java 7.

I use IntelliJ, and with Java 6, I could run my JUnit tests out of the IDE. This was convenient because it was a quick way to debug a failing test.

Since upgrading to 7 I get the following error when I try to Run a test:

scala: javac: invalid source release: 1.7
scala: Usage: javac <options> <source files>
scala: use -help for a list of possible options

I'm on OS X 10.8.5 and IntelliJ 12.1.6. Any help fixing these errors would be hugely appreciated.

1
Doesn't do the trick both javac -version and java -version are showing 1.7.0_45 for me from the console.vpiTriumph
Ok, but your IntelliJ is still using an older version of Java, not Java 7. Check your Project Settings and make sure to set the Project SDK to Java 7.Jesper
can you provide more detals of your pom.xml? do you use the scala-maven-plugin and the maven-compiler-plugin with a correct version of java set?fracca

1 Answers

0
votes

Does your setup look anything like this ? UTF-8 1.6

....

        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.1.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <args>
                    <!--<arg>-unchecked</arg>-->
                    <!--<arg>-deprecation</arg>-->
                    <!--<arg>-explaintypes</arg>-->
                </args>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
                     </configuration>
        </plugin>