首页 文章

IntelliJ:scala:javac:无效的源版本:1.7

提问于
浏览
1

我最近将Maven项目升级到Java 7 .

我使用IntelliJ,使用Java 6,我可以从IDE运行我的JUnit测试 . 这很方便,因为它是调试失败测试的快速方法 .

自升级到7后,我尝试运行测试时出现以下错误:

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

我在OS X 10.8.5和IntelliJ 12.1.6上 . 任何修复这些错误的帮助都将非常受欢迎 .

1 回答

  • 0

    你的设置看起来像这样吗? 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>
    

相关问题