Skip to content

maven设置指定jdk版本

参考maven设置指定jdk版本 链接

spring-boot项目中指定jdk版本

xml
<properties>
	<java.version>1.8</java.version>
</properties>

普通maven java项目中指定jdk版本

xml
<properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
</properties>

上面的设置实质上是在设置maven-compiler-plugin的配置,maven-compiler-plugin和上面的等价设置如下:

xml
<plugins>
    <plugin>    
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>
</plugins>