Upgrade from 2.3.3 -> 2.4 org.apache.maven.plugin.compiler.CompilationFailureException

1,184 views
Skip to first unread message

Ben Humphrey

unread,
Jul 6, 2020, 8:34:33 PM7/6/20
to error-prone-discuss
build fails with the exception below. It frustratingly outputs no other errors so I'm unsure what causes the failure. Tried running with maven -X -e but no error or warning until the above exception which gives no indicator of failure reason.

We're on JDK 1.8.  The sample pom's show <source>8</source> we had used a value of 1.8 but either throws the same error.

We override most of the bug patterns and want to clear as many as possible from existing source in order to set their values to "ERROR" but we have a very long build command line as a result (I've tried a build with minimal options, same error results).

Can anyone suggest steps for uncovering the root cause ?

Compiler Args:

compilerId = javac

debug = true

encoding = UTF-8

failOnError = true

failOnWarning = false

forceJavacCompilerUse = false

fork = true

generatedSourcesDirectory = xxxx

mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile {execution: default-compile}

optimize = false

outputDirectory = /xxxxxx/target/classes

parameters = false

projectArtifact = xxxxxx-SNAPSHOT

session = org.apache.maven.execution.MavenSession@1bfe3203

showDeprecation = false

[showWarnings = false

skipMultiThreadWarning = false

source = 8

staleMillis = 0

target = 8

useIncrementalCompilation = true

verbose = true



I've gone through our maven config and added what appears to be the required configuration. Ours is somewhat more complex in that we do our build in a separate step and the error-prone build in another.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project xxxx Compilation failure -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project xxxxx Compilation failure

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)

    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:1219)

    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:188)

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)

    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)

Thomas Broyer

unread,
Jul 7, 2020, 2:58:04 AM7/7/20
to error-prone-discuss
Have you tried turning failOnError off?
Anyway, there *should* be some output 🤔
Can you show your POM configuration?

Ben Humphrey

unread,
Jul 7, 2020, 3:54:09 AM7/7/20
to error-pro...@googlegroups.com
failOnError=false does work at least to allow it to complete (still reports the error). We have a large pom and complicating it we have a build step separate from the error-prone step so we have a separate build><plugin> part for the maven plugin which is also used for our build. Error-prone seems dependent on both parts and if I modify the part under build, it may fix error-prone but break build. 

We have a separate config file for the error-prone bugpattern args in the section<profile>...<id>prepare-errorprone-config (our pom was large when all the bug patterns were listed within). I was able to get error-prone to run successfully if I moved much of the the plugin config up out of the profile block to the build block so I made a little progress. Some of the configuration in the top part is necessary for the main build. error-prone serves more as a code-check report.  This works with error-prone 2.3.3 but not any later version.

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <showWarnings>true</showWarnings>
                    <failOnWarning>true</failOnWarning>
                    <compilerArgs>
                        <arg>${javac.lint}</arg>
                        <arg>-XDenableSunApiLintControl</arg>
                        <arg>-Xlint:-sunapi</arg>
                        <arg>-Xlint:rawtypes</arg>
                    </compilerArgs>
                </configuration>
            </plugin>


<profile>
<id>error-prone</id>
<properties>
<javac.version>9+181-r4173-1</javac.version>
<errorprone.config.path>${root-basedir}/target/errorprone-plugin-args</errorprone.config.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<workingDirectory>${root-basedir}</workingDirectory>
<addOutputToClasspath>false</addOutputToClasspath>
</configuration>
<executions>
<!-- convert config to args -->
<execution>
<id>prepare-errorprone-config</id>
<goals><goal>exec</goal></goals>
<phase>process-resources</phase>
<configuration>
<executable>/bin/bash</executable>
<arguments>
<argument>-c</argument>
<argument><![CDATA[
set -eEu
readonly source="${root-basedir}/buildtools/errorprone/errorprone-plugin-args"
readonly target="${errorprone.config.path}"

if [ ! -f $target -o $source -nt $target ]; then
mkdir -p "$(dirname "$target")"
# remove comments & squash to a single string
# without a trailing newline
printf "%s" "$(cat "$source" \
| sed 's/#.*$//' \
| tr '[:space:]' ' ' \
| sed -e 's/^ *//' -e 's/ [ ]*/ /g' \
)" > "$target"
fi
]]></argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.honton.chas</groupId>
<artifactId>readfiles-maven-plugin</artifactId>
<version>0.0.1</version>
<executions>
<execution>
<id>read-errorprone-config</id>
<goals><goal>readfiles</goal></goals>
<phase>process-resources</phase>
<configuration>
<files>
<!-- sets errorprone-plugin-args property -->
<file>${errorprone.config.path}</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<showWarnings>true</showWarnings>
<failOnWarning>false</failOnWarning>
<fork>true</fork>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne ${errorprone-plugin-args} ${error.prone.override}</arg>
</compilerArgs>

<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.3</version>
</path>
<path>
<groupId>com.uber.nullaway</groupId>
<artifactId>nullaway</artifactId>
<version>0.7.10</version>
</path>
<path>
<groupId>jp.skypencil.errorprone.slf4j</groupId>
<artifactId>errorprone-slf4j</artifactId>
<version>0.1.2</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</profile>



From: error-pro...@googlegroups.com <error-pro...@googlegroups.com> on behalf of Thomas Broyer <t.br...@gmail.com>
Sent: Monday, July 6, 2020 11:58 PM
To: error-prone-discuss <error-pro...@googlegroups.com>
Subject: [error-prone-discuss] Re: Upgrade from 2.3.3 -> 2.4 org.apache.maven.plugin.compiler.CompilationFailureException
 
This message originated outside your organization.

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:213)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:154)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:146)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (http://LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (http://DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (http://DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (http://DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (http://MavenCli.java:954)

    at org.apache.maven.cli.MavenCli.doMain (http://MavenCli.java:288)

    at org.apache.maven.cli.MavenCli.main (http://MavenCli.java:192)

    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 (http://Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (http://Launcher.java:289)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (http://Launcher.java:229)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (http://Launcher.java:415)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (http://Launcher.java:356)

Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure

    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1219)

    at org.apache.maven.plugin.compiler.CompilerMojo.execute (http://CompilerMojo.java:188)

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:208)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:154)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (http://MojoExecutor.java:146)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (http://LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (http://DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (http://DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (http://DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (http://MavenCli.java:954)

    at org.apache.maven.cli.MavenCli.doMain (http://MavenCli.java:288)

    at org.apache.maven.cli.MavenCli.main (http://MavenCli.java:192)

    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 (http://Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (http://Launcher.java:289)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (http://Launcher.java:229)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (http://Launcher.java:415)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (http://Launcher.java:356)

--
Googlers: This an external list. Please be careful when posting.
---
You received this message because you are subscribed to a topic in the Google Groups "error-prone-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/error-prone-discuss/Xv21woOkFJo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to error-prone-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/error-prone-discuss/42fda275-51e5-4e8f-96c6-86e334e5c4ffo%40googlegroups.com.

Mark Derricutt

unread,
Jul 7, 2020, 1:22:49 PM7/7/20
to error-pro...@googlegroups.com

I notice you’re running nullaway there - I also had issues with error prone 2.4 when using NullAway, but in my case I was getting reports of an older version of error prone being pulled into the classpath which looked to be coming from a transitive dependency of NullAway.

I’ve been meaning to try and isolate the issue so I can post a bug over on NullAway - but wonder if that’s a similar issue to what your hitting?
You received this message because you are subscribed to the Google Groups "error-prone-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to error-prone-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/error-prone-discuss/BYAPR05MB6487E8E7F954AC79F9CEE2D6E5660%40BYAPR05MB6487.namprd05.prod.outlook.com.

Mark Derricutt

unread,
Jul 7, 2020, 1:22:49 PM7/7/20
to error-pro...@googlegroups.com

I notice you’re running null away

On 7 July 2020 at 7:54:01 PM, 'Ben Humphrey' via error-prone-discuss (error-pro...@googlegroups.com) wrote:

Manu Sridharan

unread,
Jul 7, 2020, 1:31:20 PM7/7/20
to error-pro...@googlegroups.com
FWIW we've updated the master branch of NullAway to use Error Prone 2.4.  So if you think there is a NullAway issue, you could try the latest snapshot to see if that fixes it.  If the latest snapshot does fix the problem, open a GitHub issue and let us know, and we can try to cut a new release sooner rather than later.

--Manu

Ben Humphrey

unread,
Jul 7, 2020, 1:39:07 PM7/7/20
to error-pro...@googlegroups.com
The issue for me was I had -Xep:NullableDereference:OFF (https://errorprone.info/bugpattern/NullableDereference) in my configured list of bug patterns. I'm guessing this is now deprecated as I no longer see it in https://errorprone.info/bugpatterns   Removing it caused the immediate CompilationException to disappear.
Bug patterns. This list is auto-generated from our sources. Each bug pattern includes code examples of both positive and negative cases; these examples are used in our regression test suite.



From: error-pro...@googlegroups.com <error-pro...@googlegroups.com> on behalf of Manu Sridharan <msri...@gmail.com>
Sent: Tuesday, July 7, 2020 10:31 AM
To: error-pro...@googlegroups.com <error-pro...@googlegroups.com>
Subject: Re: [error-prone-discuss] Re: Upgrade from 2.3.3 -> 2.4 org.apache.maven.plugin.compiler.CompilationFailureException
 

Ben Humphrey

unread,
Jul 7, 2020, 2:02:24 PM7/7/20
to error-pro...@googlegroups.com
Thanks Mark and Manu. It does appear to be related to Nullaway.  Our config is complex so I have to walk back some changes and see if I can move forward with 2.4. 
I'll attempt to setup with the latest Nullaway snapshot. 



From: 'Ben Humphrey' via error-prone-discuss <error-pro...@googlegroups.com>
Sent: Tuesday, July 7, 2020 10:39 AM

Manu Sridharan

unread,
Jul 7, 2020, 2:09:28 PM7/7/20
to error-pro...@googlegroups.com
I just noticed that our automatic snapshot uploads are not working :-(  I opened an issue and we'll work on it: https://github.com/uber/NullAway/issues/405

In the meantime you can clone NullAway and run `./gradlew :nullaway:install` on the master branch to install the snapshot to a local Maven repo.

Best,
Manu

Reply all
Reply to author
Forward
0 new messages