在 Maven 编译时,可以通过配置插件来去掉 ' @Override ' 的检查。

在 'pom.xml' 文件中,添加如下配置:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <compilerArgument>-Xlint:-overrides</compilerArgument>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>

在上述配置中,'compilerArgument' 参数设置为 '-Xlint:-overrides',表示禁用 ' @Override ' 的检查。

保存 'pom.xml' 文件后,执行 Maven 编译命令即可去掉 ' @Override ' 的检查。

mvn compile

这样,编译时就不会再检查 ' @Override ' 注解的使用了。

Maven 编译时禁用 @Override 检查

原文地址: https://www.cveoy.top/t/topic/qDy6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录