当前位置:首页 > 编程笔记 > 正文
已解决

maven重新加载后Target bytecode version总是变回1.8

来自网友在路上 150850提问 提问时间:2023-11-10 13:30:55阅读次数: 50

最佳答案 问答题库508位专家为你答疑解惑

现象

Load Maven Changes后
Settings - Build, Execution, Deployment - Java Compiler - Target bytecode version总是变为1.8
Project Structure - Modules - Language level总是变为1.8

解决方法

方法一

pom.xml中包含

<project>[...]<build>[...]<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target></configuration></plugin></plugins>[...]</build>[...]
</project>

或者

<project>[...]<properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target></properties>[...]
</project>

将1.8改为合适的java版本即可

方法二

如果pom.xml中没有上述配置,打开maven设置文件
Settings - Build, Execution, Deployment - Build Tools - Maven - User settings file可以找到文件路径
将文件中下面的设置注释掉即可

<settings>[...]<profiles><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target></properties></profiles>[...]
</settings>
查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"maven重新加载后Target bytecode version总是变回1.8":http://eshow365.cn/6-37262-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!