Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failure when analyzing maven project #758

Open
anikulin opened this issue Sep 28, 2017 · 3 comments
Open

Compilation failure when analyzing maven project #758

anikulin opened this issue Sep 28, 2017 · 3 comments

Comments

@anikulin
Copy link

anikulin commented Sep 28, 2017

Trying to analyze my maven project using infer on docker image:
>infer run --debug -- mvn -e package
Process fails on different modules with following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project ...: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project ...: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
...
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1165)
        at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more

Uncaught exception:

  (Failure
    "*** ERROR: Maven command failed:\
   \n*** mvn -e package -P infer-capture\
   \n*** exited with code 1\
   \n")

Raised at file "pervasives.ml", line 32, characters 17-33
Called from file "backend/infer.ml", line 510, characters 2-21
Called from file "backend/infer.ml", line 566, characters 32-45

Log files give no clue on what's happening. At the same time, infer works fine with the sample maven project created using mvn archetype:generate.

Maven compiler plugin configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <showDeprecation>true</showDeprecation>
        <showWarnings>true</showWarnings>
        <compilerArgs>
            <arg>-Xlint:rawtypes</arg>
            <arg>-Xlint:unchecked</arg>
        </compilerArgs>
    </configuration>
</plugin>

Infer version v0.12.1
Apache Maven 3.3.9
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-119-generic", arch: "amd64", family: "unix"

@jvillard
Copy link
Contributor

Is there a visible failure in infer-out/logs (maybe something about javac failing)? I don't know how to see build logs from maven but there might be an error there too that mvn is not showing on the terminal.

@anikulin
Copy link
Author

No, everything looks fine in the infer-out\log\driver\out.log

Trying to execute: 'javac' '-J-Duser.language=en' '@/tmp/org.codehaus.plexus.compiler.javac.JavacCom
piler7516181446605658049arguments' '@/tmp/args_9a4031' 2>'/tmp/javac_70d85a.out'
*** Success. Logs:
Translating 9 source files (13 classes)
loading program ... done

filename: src/main/java/.../....java (....java)
        classname: ...

So it looks like it compiled all sources, then captured a single class file and failed.

Maven was started with -e switch but it only gives the stacktrace.

@JuditKnoll
Copy link

JuditKnoll commented Feb 26, 2024

I also encountered this problem. Downgrading to infer version 1.0.0 solves the problem. The following issues are about this same problem: #1420, #1519, #1634, #1803.
Also #1783 is quite similar as well, which was already solved by #1784, so maybe the problem will be fixed in the next release. However I could build my project using the maven-compiler-plugin version 3.8.0 without capturing the output with infer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants