IDEA解决Maven工程的Language Level默认为5的问题

只要在pom.xml中指定Java版本即可。

方法一

在pom.xml文件中添加:

<properties>
    <!--指定Java版本-->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

方法二

在pom.xml文件中添加:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
            	<!--指定Java版本-->
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
发布了46 篇原创文章 · 获赞 0 · 访问量 2009

猜你喜欢

转载自blog.csdn.net/hon_vin/article/details/103778697