Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven错误:源代码1.6中不支持菱形运算符_Java_Eclipse_Maven - Fatal编程技术网

Java Maven错误:源代码1.6中不支持菱形运算符

Java Maven错误:源代码1.6中不支持菱形运算符,java,eclipse,maven,Java,Eclipse,Maven,关于这个问题,已经有很多话题了,但我不能用同样的方法来解决这个问题。在使用Maven编译时,我遇到了一个错误。当我在调试模式下重建它时,我看到它再次使用1.6编译,尽管Java版本在Java_HOME中定义为1.7,并在Eclipse中安装了JRE。我已尝试将以下内容添加到根目录和子项目目录,但问题仍然存在 错误消息 AttendanceSite.java:[49127] @Getter@Setter私有集attendanceStatuses=新哈希集(0); Maven调试输出 1.6 p

关于这个问题,已经有很多话题了,但我不能用同样的方法来解决这个问题。在使用Maven编译时,我遇到了一个错误。当我在调试模式下重建它时,我看到它再次使用1.6编译,尽管Java版本在Java_HOME中定义为1.7,并在Eclipse中安装了JRE。我已尝试将以下内容添加到根目录和子项目目录,但问题仍然存在

错误消息

AttendanceSite.java:[49127]

@Getter@Setter私有集attendanceStatuses=新哈希集(0);
Maven调试输出

1.6
pom.xml(根目录)


org.apache.maven.plugins
maven javadoc插件
3.0.1
1.7
1.7
pom.xml(在项目文件夹中)


1.7
1.7

JAVA_HOME变量通常仅由
mvn
命令用于确定JDK的位置,但这不应影响编译器设置(当然,除非您需要版本等于或高于编译器设置的JDK)

您可以通过属性(例如,<代码> Maven,编译器。源代码/代码>)配置“<代码> Maven编译器插件< /代码>,但也可以直接在插件定义中(我会考虑更安全的选项)。只需将其添加到插件定义中

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

org.apache.maven.plugins
maven编译器插件
3.6.1
1.7
1.7

这也可以通过以下方法实现:


1.7
1.7

maven javadoc plugin
=>使用编译器而不是javadoc。谢谢,事实上,首先,我按照您指定的那样做了,但它不起作用,然后我添加了main pom.xml,但这次我指定的参数不正确。
@Getter @Setter private Set<AttendanceStatus>   attendanceStatuses  = new HashSet<>(0);
<source default-value="1.5">1.6</source>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.0.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.6.1</version>
    <configuration>
      <source>1.7</source>
      <target>1.7</target>
    </configuration>
  </plugin>
</plugins>