【问题标题】:Not able maven build "strings in switch are not supported in -source 1.5 in eclipse while maven build"无法构建 Maven 构建“在 Eclipse 中 -source 1.5 中不支持交换机中的字符串,而 Maven 构建”
【发布时间】:2018-01-10 13:07:21
【问题描述】:

在运行 as->maven 构建时,eclipse 中的 -source 1.5(使用 -source 7 或更高版本以在 switch 中启用字符串)不支持我在 switch 中获取字符串。我使用的是 java 8,操作系统是 ubuntu 16.04。

【问题讨论】:

标签: java eclipse maven build


【解决方案1】:

您需要在 java 版本 1.8 中添加 maven-compiler-plugin

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

然后转到项目属性> java 编译器选择 jdk 版本 1.8。

【讨论】:

    猜你喜欢
    • 2018-05-15
    • 2016-05-25
    • 1970-01-01
    • 2015-02-04
    • 2013-05-24
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    • 2018-01-04
    相关资源
    最近更新 更多