Maven + error-prone + nullaway - forced JDK 8

722 views
Skip to first unread message

Jan Endel

unread,
Mar 7, 2020, 5:50:11 PM3/7/20
to error-prone-discuss
Hello,

I'm trying to add null away with error prone to my spring app, with this configuration:

<plugin>
 
<groupId>org.apache.maven.plugins</groupId>
 
<artifactId>maven-compiler-plugin</artifactId>
 
<version>3.8.0</version>
 
<configuration>
 
<compilerId>javac-with-errorprone</compilerId>
 
<forceJavacCompilerUse>true</forceJavacCompilerUse>
 
<showWarnings>true</showWarnings>
 
<annotationProcessorPaths>
 
<path>
 
<groupId>com.uber.nullaway</groupId>
 
<artifactId>nullaway</artifactId>
 
<version>0.7.9</version>
 
</path>
 
</annotationProcessorPaths>
 
<compilerArgs>
 
<arg>-XDcompilePolicy=byfile</arg>
 
<arg>-Xplugin:ErrorProne</arg>
 
<arg>-Xep:NullAway:ERROR</arg>
 
<arg>-XepOpt:NullAway:AnnotatedPackages=com.uber</arg>
 
</compilerArgs>
 
</configuration>
 
<dependencies>
 
<dependency>
 
<groupId>org.codehaus.plexus</groupId>
 
<artifactId>plexus-compiler-javac-errorprone</artifactId>
 
<version>2.8</version>
 
</dependency>
 
<dependency>
 
<groupId>com.google.errorprone</groupId>
 
<artifactId>error_prone_core</artifactId>
 
<version>2.3.4</version>
 
</dependency>
 
</dependencies>
</plugin>


But, on start it keep telling me:

error: cannot access List
import java.util.List;
^
bad
class file: /modules/java.base/java/util/List.class
class file has wrong version 55.0, should be 53.0


Please remove or make sure it appears in the correct subdirectory of the classpath.

Which means I'm trying to compile this for Java 8, when I'm using Java 11. This error appear in Idea and in CLI

I already check my javac version (11.0.4), java version (openJDK 11.0.4), my compiler settings in Idea (all modules to Java 11) and my project structure in Idea - Java 11. What I should try to make it works?

When I remove whole plugin from my pom file, it compiles successfully. I'm not sure, if this question belongs to this group or in nullaway group, in that case - sorry!
TIA

Jan Endel

Thomas Broyer

unread,
Mar 8, 2020, 8:12:23 AM3/8/20
to error-prone-discuss
The plexus-compiler-javac-errorprone can only be used with Java 8 (possibly 9, maybe 10, but definitely not 11).
See https://errorprone.info/docs/installation for the proper way to configure your Maven build.

Jan Endel

unread,
Mar 8, 2020, 8:44:15 AM3/8/20
to error-pro...@googlegroups.com
You are absolutely right! Thanks a lot!

Jan Endel
--
Googlers: This an external list. Please be careful when posting.
---
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/28842ed5-4281-4388-9242-35f5cbce4ca1%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages