Error:java: javacTask: source release 8 requires target release 1.8

Why can’t you grab tickets when you travel on holiday?Reveal the key technology of 12306 how to ensure the ticket is not oversold>>>

When running the project with idea, the following error message is encountered:

Error:java: javacTask: source release 8 requires target release 1.8

This is mainly due to the fact that the code written in idea based on JDK 1.8 does not find the corresponding JDK compiler. The solution is as follows:

1. Open file > Settings > Build, Execution, Deployment > Java Compiler

2. Change the bytecode version of the compiled code to 1.8, as shown in the figure below:

3. If Maven is used in the project, you can also change the setting of pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Choose one of the above two methods (1, 2 and 3). Note that after changing the pom.xml file, you need to select the reimport option in the Maven menu of idea to re import the project settings. Idea will automatically select the correct settings

Reference link: https://stackoverflow.com/questions/29888592/errorjava-javactask-source-release-8-requires-target-release-1-8

Similar Posts: