目錄
方案一: 我沒有使用
方案二:修改maven配置文件
前言:每次創(chuàng)建一個maven模塊時java compiler版本就是1.6與實際版本不一致
使用的使用maven3.9.1 jdk17,但是每次創(chuàng)建一個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>
參照博主:文章來源:http://www.zghlxwxcb.cn/news/detail-686090.html
https://www.cnblogs.com/east7/p/13363069.html文章來源地址http://www.zghlxwxcb.cn/news/detail-686090.html
到了這里,關于【java】[maven]每次創(chuàng)建一個maven模塊時java compiler版本就是1.6與實際版本不一致(解決本質問題)的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!