maven error: [ERROR] Source option 7 is no longer supported. Please use version 8 or higher.

solution

Add the java.version jdk version setting of maven compilation to the pom.xml file, as well as the maven.compiler.source resource compilation jdk version setting and maven.compiler.target resource build jdk version setting.

JDK:6~8

Generally, they are written in 1.6, 1.7, and 1.8.

 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties> 

JDK≥10

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <java.version>20</java.version>
        <maven.compiler.source>20</maven.compiler.source>
        <maven.compiler.target>20</maven.compiler.target>
</properties>

Guess you like

Origin blog.csdn.net/qq_33589510/article/details/132638353