Error Prone Maven Build Fail

187 views
Skip to first unread message

Chris Brown

unread,
May 12, 2017, 2:29:04 AM5/12/17
to error-prone-discuss
I'm trying to run the maven example for Error Prone but get the following error when trying to compile error_prone_should_flag and annotation_processing_bug_repro. Has anyone run into this problem or know how to fix it?

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project annotation_processing_bug_repro: Compilation failure -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException






Chris Brown

unread,
May 12, 2017, 2:30:33 AM5/12/17
to error-prone-discuss
With debugging output:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project annotation_processing_bug_repro: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project annotation_processing_bug_repro: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:915)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more

Thomas Broyer

unread,
May 12, 2017, 3:47:20 AM5/12/17
to error-prone-discuss
If these are examples showing how error prone flags errors (I'm on mobile, highly inconvenient to check), then you've just proved they work \o/

Have a look upper in the logs to find the compilation errors. What you gave is only the summary of the build outcome.

Chris Brown

unread,
May 12, 2017, 9:32:17 AM5/12/17
to error-prone-discuss
The correct compilation error is returned, but the build is still failing. Attached is the full log.

[INFO] Compiling 2 source files to /var/lib/jenkins/workspace/ErrorProne/examples/maven/error_prone_should_flag/target/classes
/var/lib/jenkins/workspace/ErrorProne/examples/maven/error_prone_should_flag/src/main/java/Main.java:20: error: [DeadException] Exception created but not thrown
    new RuntimeException();
    ^
    (see http://errorprone.info/bugpattern/DeadException)
  Did you mean 'throw new RuntimeException();'?
1 error
log.txt

Thomas Broyer

unread,
May 12, 2017, 11:13:01 AM5/12/17
to error-prone-discuss


On Friday, May 12, 2017 at 3:32:17 PM UTC+2, Chris Brown wrote:
The correct compilation error is returned, but the build is still failing.

This is expected: this is how Error Prone works: it reports violations as compilation warnings or errors; and compilation errors then fail the build.
(note that all example outputs in http://errorprone.info/docs/installation indicate that the build has failed)

Chris Brown

unread,
May 12, 2017, 11:28:08 AM5/12/17
to error-prone-discuss
Ah, ok thanks. I assumed Error Prone would find errors but the build would still pass.

Thomas Broyer

unread,
May 12, 2017, 11:44:45 AM5/12/17
to error-prone-discuss
The stated goal is to "eliminate classes of serious bugs from entering our code", and only reporting them without failing the build would likely lead to the reports being ignored and the bugs "entering the code".

(disclaimer: just a user here, not a project member)

Chris Brown

unread,
May 12, 2017, 11:47:23 AM5/12/17
to error-prone-discuss
No problem, that makes sense and thanks for you help. I was just confused by the error message returned by the build failure.
Reply all
Reply to author
Forward
0 new messages