The default target bytecode version of idea creation project is 1.5


 Problem Description:

The default target bytecode version of idea creation project is 1.5

 


Manually change Project Settings => Modules ==>Language level to 8

Solution 1:

1) Manually change Project Settings => Modules ==>Language level to 8

 

2) Manually change the target bytecode version of Settings => Build, Execution, Deployment => Java Compiler to 1.8

)


3) After reimporting maven, the target bytecode version still changes to 1.5

Solution 2:

Add the following build in the pom file, but it still has no effect

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

 

Solution 3:

Found that the parent is missing in pom.xml, the default target bytecode version is 1.5

 


After removing the comment, the target bytecode version becomes 1.8


Summary:
If no parent is added, idea will set the target bytecode version to 1.5 by default, and it will not change if you manually change it. The solution is to add parent
 

Guess you like

Origin blog.csdn.net/di_ko/article/details/114822274