欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

idea编译报错 javacTask:源发行版1.8 需要目标发行版1.8

程序员文章站 2022-07-14 10:43:04
...
Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8
Information:2018/1/9 22:12 - Compilation completed with 1 error and 0 warnings in 2s 752ms
Error:java: Compilation failed: internal java compiler error
Information:Module "algorithm" was fully rebuilt due to project configuration/dependencies changes
Information:javac 1.8.0_92 was used to compile java sources
Information:java: Errors occurred while compiling module 'algorithm'

1,Project Structure里确认两个地方:Project sdk以及project language level

2,Project Structure->Modules里Sources里的Language level

3,Preferences-> Build,Execution, Deployment ->java Compiler->Per-module bytecode Version

这三个地方需要一致。
idea编译报错 javacTask:源发行版1.8 需要目标发行版1.8
idea编译报错 javacTask:源发行版1.8 需要目标发行版1.8

如果是maven项目可以通过pom.xml设置编译的版本号

 <build>
        <plugins>
            <!--compiler插件-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>${file.encoding}</encoding>
                </configuration>
            </plugin>         
        </plugins>
    <build>
相关标签: idea java