Infer capture fails with Maven, succeeds without fork, but can't analyze

41 Views Asked by At

I am trying to perform static analysis of a Java project for null dereference errors using Facebook Infer, while using Maven to build the project and perform unit tests. Here's the part of pom.xml that is responsible for working with Infer:

<profile>
   <id>infer-capture</id>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
               <verbose>true</verbose>
               <fork>true</fork>
               <executable>/PATH/TO/INFER/infer</executable>
               <useIncrementalCompilation>false</useIncrementalCompilation>
            </configuration>
         </plugin>
      </plugins>
   </build>
</profile>

Here's my status quo:

  • When I run mvn clean test, everything builds and tests successfully.
  • When I run infer capture -- mvn clean test with this project, I get a MojoFailureException.
  • When I comment out the <fork>true</fork> line, the capture process terminates successfully. However, when I run infer analyze afterwards, I get "Nothing to analyze."
  • When I run infer capture -- mvn clean test --fail-never and analyze the project, only about a quarter of all source files is analyzed.

As this is my first time working with Infer, I can't seem to grasp what is causing this issue. The above pom.xml snippet is used in many other projects and never caused an error. I'm especially frustrated because the MojoFailureException basically tells me nothing about the root cause.

Any suggestions for the root cause and/or solutions would be grateful.

0

There are 0 best solutions below