[英]How to exclude error prone from being run on unit tests?
When maven-compiler-plugin:3.8.0:testCompile @ foo-child
runs, thread dumps show errorprone is taking an extremely long time. 当maven-compiler-plugin:3.8.0:testCompile @ foo-child
运行时,线程转储显示errorprone需要很长时间。 I believe there is a bug with errorprone, but for now I'd rather just have errorprone not run on unit tests. 我相信errorprone存在一个错误,但是现在我宁愿让errorprone不在单元测试中运行。
I have a parent pom.xml: 我有一个父pom.xml:
<modules>
<module>foo-child</module>
</modules>
<dependencyManagement>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</dependency>
// also has dependency for io.norberg auto-matter and com.google.auto.value auto-value
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
// also has annotationProcessorPaths configuration for auto-matter and auto-value
</plugin>
</plugins>
</build>
Is there anything I can put in the foo-child pom.xml that will allow me to exclude maven-compiler-plugin:3.8.0:testCompile @ foo-child
from being run at all. 有什么我可以放在foo-child pom.xml中,这将允许我排除maven-compiler-plugin:3.8.0:testCompile @ foo-child
没有运行。
I cannot exclude error prone completely because other things like guava depend on it. 我不能完全排除容易出错,因为像番石榴这样的其他东西依赖于它。
EDIT: Seems like this user is trying to solve the same problem. 编辑:似乎这个用户正试图解决同样的问题。 Do you know how I could apply the solution given there to my case? 你知道我怎么能把那里给出的解决方案应用到我的案例中吗?
Use error prone's command line flag to disable checks: -XepDisableAllChecks 使用容易出错的命令行标志来禁用检查: -XepDisableAllChecks
Similar answer for disabling error prone in bazel 类似的答案 ,禁止在bazel中容易出错
add --javacopt="-XepDisableAllChecks" to your bazelrc 将-javacopt =“ - XepDisableAllChecks”添加到您的bazelrc
For specific test(s) use -XepExcludedPaths
: 对于特定测试,请使用-XepExcludedPaths
:
you can completely exclude certain paths from any Error Prone checking via the -XepExcludedPaths flag 您可以通过-XepExcludedPaths标志完全排除任何错误突发检查中的某些路径
-XepExcludedPaths:.*/build/generated/.*
您可以使用“ 包含和排除测试”插件。
You can add the -XepExcludedPaths
compiler option to your maven build. 您可以将-XepExcludedPaths
编译器选项添加到maven构建中。
https://errorprone.info/docs/flags https://errorprone.info/docs/flags
You can add maven profile to foo-child
module which will run the build without errorprone. 您可以将maven配置文件添加到foo-child
模块,该模块将在没有errorprone的情况下运行构建。 Also you can make the activation of that profile dependent from some parameter and set that parameter's value in parent pom. 您还可以从某个参数激活该配置文件,并在父pom中设置该参数的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.