-source 1.5 [ERROR]不支持switch中的字符串(使用-source 7或更高版本来启用switch中的字符串)

时间:2017-03-05 07:38:36

标签: java eclipse maven

我正在使用Java 1.8.101版本。当我运行maven clean install时,那时我收到错误

strings in switch are not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable strings in switch).

我不知道为什么,因为我已经在使用java 1.8.101版本了。\

任何帮助都会很棒。 非常感谢您提前寻求帮助。 附上截图。

java

1 个答案:

答案 0 :(得分:4)

正如@Jeremy已经建议的那样,输入pom.xml文件作为 -

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.6.1</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
</plugins>

并在命令行上使用mvn clean install来验证更改。