如何将警告更改为容易出错的错误?
How do I change warnings to Errors with Error Prone?
当我运行mvn clean compile
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.0.6</version>
</dependency>
</dependencies>
</plugin>
我一直在尝试启用 MissingOverride
作为错误,或者实际上只是为了发出任何东西,对于初学者来说,我需要更改什么才能看到 "warnings" 的输出然后我应该怎么做怎么做才能让 MissingOverride
出错?
似乎是 plexus-compiler-javac-errorprone
的错误,它不输出警告,但是要将 MissingOverride
转换为错误,您可以将 -Xep:MissingOverride:ERROR
标志传递给编译器,如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xep:MissingOverride:ERROR</arg>
</compilerArgs>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
</plugin>
当我运行mvn clean compile
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.0.6</version>
</dependency>
</dependencies>
</plugin>
我一直在尝试启用 MissingOverride
作为错误,或者实际上只是为了发出任何东西,对于初学者来说,我需要更改什么才能看到 "warnings" 的输出然后我应该怎么做怎么做才能让 MissingOverride
出错?
似乎是 plexus-compiler-javac-errorprone
的错误,它不输出警告,但是要将 MissingOverride
转换为错误,您可以将 -Xep:MissingOverride:ERROR
标志传递给编译器,如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xep:MissingOverride:ERROR</arg>
</compilerArgs>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
</plugin>