目录
方案一: 我没有使用
方案二:修改maven配置文件
前言:每次创建一个maven模块时java compiler版本就是1.6与实际版本不一致
使用的使用maven3.9.1 jdk17,但是每次创建一个maven模块都是会影响之前的模块。网上都是修改pom.xml
方案一: 我没有使用
因为在项目中如果没有指定jdk的版本,重新运行的时候都会默认恢复为1.X版本
<profile>
<id>java-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>
方案二:修改maven配置文件
<!-- ${MAVEN_HOME}/conf/settings.xml 文件添加如下profile配置,建立的java项目默认使用java 17 -->
<profiles>
<profile>
<id>jdk-17</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>17</jdk>
</activation>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
参照博主:文章来源:https://www.toymoban.com/news/detail-686090.html
https://www.cnblogs.com/east7/p/13363069.html文章来源地址https://www.toymoban.com/news/detail-686090.html
到了这里,关于【java】[maven]每次创建一个maven模块时java compiler版本就是1.6与实际版本不一致(解决本质问题)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!