1.设置全局的jdk,在maven的配置文件setting.xml中的profiles节点元素下添加:如下profile节点信息---此处版本设置为jdk1.8
<profile>
<id>jdk1.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>
2.设置局部的jdk,在所选项目的pom.xml文件中:添加如下build元素节点信息----此处版本设置为jdk1.8
<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>
本文介绍如何使用Maven配置项目的Java开发工具包(JDK)版本,包括全局设置和局部设置两种方式。通过编辑setting.xml和pom.xml文件,可以指定项目使用的JDK版本。
944

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



