您好,欢迎来到外链网!
当前位置:外链网 » 站长资讯 » 专业问答 » 文章详细 订阅RssFeed

maven配置java版本,maven编译指定jdk版本

来源:互联网 浏览:65次 时间:2023-04-08

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> 便宜香港vps <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile>

????????【注意】如果本地没有1.8的JDK,该配置将不会生效

?

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