Maven搭建项目时默认J2SE-1.5解决方法

时间:2021-12-04 23:11:54

构建Maven工程的时候报以下告警:

Description Resource Path Location Type

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. richs Build path JRE System Library Problem


解决方式:在maven setting.xml中添加

<profile>
            <id>jdk-1.8</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <properties>  
                <maven.compiler.source>1.8</maven.compiler.source>  
                <maven.compiler.target>1.8</maven.compiler.target>  
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
            </properties>
    </profile>

1.8对应jdk1.8,可以自定义修改为自己想要的jdk版本