Skip to content

IDEA 自动重置 Language level 的解决办法

编译时出现【错误: -source 1.5 中不支持 lambda 表达式】错误,代码上显示【Usage of API documented as @since 1.6+】提示。

在【Project Structure】中将对应 Model 的 Language level 改成【Project default(8 - Lambdas, type annotation etc.)】后,代码上的提示消失了,但是通过 Maven 编译时仍然提示【错误: -source 1.5 中不支持 lambda 表达式】。


解决方法

如使用 maven-compiler-plugin 插件打包可以使用如下方式

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

通用的简单写法

xml
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

参考

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.