Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I believe there is a bug with errorprone, but for now I'd rather just have errorprone not run on unit tests.

I have a parent 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.

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?

like image 610
lf215 Avatar asked Apr 18 '19 19:04

lf215


2 Answers

Use error prone's command line flag to disable checks: -XepDisableAllChecks

Similar answer for disabling error prone in bazel

add --javacopt="-XepDisableAllChecks" to your bazelrc

For specific test(s) use -XepExcludedPaths:

you can completely exclude certain paths from any Error Prone checking via the -XepExcludedPaths flag

-XepExcludedPaths:.*/build/generated/.*
like image 65
user7294900 Avatar answered Oct 11 '22 12:10

user7294900


You can use the Inclusions and Exclusions of Tests plugin for this.

like image 24
Anurag Singh Avatar answered Oct 11 '22 11:10

Anurag Singh