在自己安装的maven文件下,找到conf文件
点击maven文件,打开setting.xml文件,要用编辑器打开,我们需要向该文件中增加内容,这里使用的是vscode
在setting的profiles标签下,复制以下内容:
<profile>
<id>development</id>
<activation>
<jdk>11</jdk>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
</properties>
</profile>
如图:在这里我们进行maven的jdk版本的设定
之后我们在idea中重新创建maven就可以成功运行了