在pom.xml文件中添加:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
参考:https://stackoverflow.com/questions/54859623/references-to-interface-static-methods-are-allowed-only-at-source-level-1-8-or-a
网上另一种方式是修改项目右键properties中的Project Facets的Java版本,但是我的已经是1.8了,不能解决问题。