Maven配置文件中配置指定JDK版本

1. 在setting.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>  
        【注意】如果本地没有1.7的JDK,该配置将不会生效

2. 配置完成之后就可以在创建Maven项目时使用该指定JDK版本

猜你喜欢

转载自blog.csdn.net/kimihuancsdn/article/details/80094538