maven默认jdk版本修改为自己安装的jdk版本,将以下内容添加到settings.xml的profiles标签中,
<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>
<profile>
<id>custom-compiler</id>
<properties>
<JAVA8_HOME>C:\java\JDK\bin</JAVA8_HOME>
</properties>
</profile>
再将以下内容添加到activeProfiles标签中
<activeProfiles>
<activeProfile>custom-compiler</activeProfile>
<!-- <activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>-->
</activeProfiles>
本文介绍了如何修改Maven的默认JDK版本,以使用自己安装的JDK 1.8。通过在settings.xml文件中添加profile,并设置对应的jdk版本以及maven.compiler的相关属性,可以实现这一目标。同时,还需要在activeProfiles中激活对应的profile,确保构建时使用指定的JDK路径。
961

被折叠的 条评论
为什么被折叠?



