preview解析JAVA_Spring Boot 2.3中开启JDK14预览版(Preview)功能(文本块等)
JAVA中的文本块等功能需要编译时添加--enable-preview参数,IDEA中只要选择了Language level为14-Preview即可:
image.png
但是这样修改后,不能使用mvn spring-boot:run来运行,而且一旦修改了pom.xml文件,设置的14-preview会再次被同步成14,那spring boot中如何添加--enable-preview参数呢?
经过研究和查找,终找到方案,将pom.xml中的plugins部分修改为如下即可:
...
org.springframework.boot
spring-boot-maven-plugin
--enable-preview
--enable-preview
org.apache.maven.plugins
maven-surefire-plugin
2.22.2
--enable-preview
org.apache.maven.plugins
maven-compiler-plugin
3.8.1
--enable-preview
...
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
