从别处导入的project,build时会有这样的问题。

目前本地是openjdk11.0.2

更改IDEA配置如下

File > Settings

Error:java: error: release version 5 not supported & Switch不识别String

 

switch中str为string型时报错,要改下面这两个地方:

File >project structure

Error:java: error: release version 5 not supported & Switch不识别String

Error:java: error: release version 5 not supported & Switch不识别String

 

但是上面三种配置,当pom变化了,重新build时,这三个地方还是自动变回默认设置去了,所以还是需要在父pom中的<project>下加maven-compiler-plugin插件,并指定jdk使用的jdk版本(我当前用的是openjdk 11.0.2,发现直接配个11就可以了,上面三个地方的设置会自动变成11那个选项)

<build>
<plugins>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
        <source>11</source>
        <target>11</target>
    </configuration>
</plugin>
</plugins>
</build>

转载于:https://my.oschina.net/hcp/blog/3029214

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2021-05-01
  • 2021-09-27
猜你喜欢
  • 2021-09-15
  • 2022-01-20
  • 2021-08-17
  • 2021-11-24
  • 2021-07-24
  • 2021-12-13
  • 2021-07-18
相关资源
相似解决方案