tbroyer/gradle-errorprone-plugin-v0.0.x

Gradle 2.8 + Java 7 build failure = Unsupported major.minor version 52.0

jaredsburrows opened this issue · 4 comments

21:59:56 Executing task ':compileDebugJavaWithJavac' (up-to-date check took 0.058 secs) due to:
21:59:56   No history is available.
21:59:57 All input files are considered out-of-date for incremental task ':compileDebugJavaWithJavac'.
21:59:57 Compiling with error-prone compiler
21:59:58 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_core/2.0.6/error_prone_core-2.0.6.pom
21:59:58 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_parent/2.0.6/error_prone_parent-2.0.6.pom
21:59:58 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotation/2.0.6/error_prone_annotation-2.0.6.pom
21:59:58 Download https://jcenter.bintray.com/com/google/errorprone/javac/1.9.0-dev-r2973-2/javac-1.9.0-dev-r2973-2.pom
21:59:59 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.6/error_prone_annotations-2.0.6.pom
21:59:59 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_core/2.0.6/error_prone_core-2.0.6.jar
22:00:00 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotation/2.0.6/error_prone_annotation-2.0.6.jar
22:00:00 Download https://jcenter.bintray.com/com/google/errorprone/javac/1.9.0-dev-r2973-2/javac-1.9.0-dev-r2973-2.jar
22:00:00 Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.6/error_prone_annotations-2.0.6.jar
22:00:00 :compileDebugJavaWithJavac FAILED
22:00:00 :compileDebugJavaWithJavac (Thread[Daemon worker,5,main]) completed. Took 3.79 secs.
22:00:00 
22:00:00 FAILURE: Build failed with an exception.
22:00:00 
22:00:00 * What went wrong:
22:00:00 Execution failed for task ':compileDebugJavaWithJavac'.
22:00:00 > javax/tools/DiagnosticListener : Unsupported major.minor version 52.0
22:00:00 
22:00:00 * Try:
22:00:00 Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
22:00:00 
22:00:00 BUILD FAILED
22:00:00 

I did not see this error last week, did something change? Did something get published or overwritten?

+1 Same here ... there is something in there that only works with Java 8 ... looks like sth in checkerframework.

Error Prone 2.0.6 released on Oct 28 now requires a Java 8 runtime: google/error-prone#369

You can either:

  • pin Error Prone to 2.0.5 (see the README for how to do it, it's a good idea to pin your versions anyway)

  • run your build with a Java 8 runtime but configure your compile tasks to either use a Java 7 JDK:

    tasks.withType(JavaCompile) {
      options.fork = true
      options.forkOptions.executable = "/path/to/jdk7/bin/javac"
    }

    or set the bootclasspath and extdirs accordingly:

    tasks.withType(JavaCompile){
      options.bootClasspath = "/path/to/jdk7/lib/rt.jar"
      options.extensionDirs = ""
    }

    (pending support for Java toolchains in Gradle)

With this bug in mind: Wouldn't it be better if gradle-errorprone-plugin would depend on a fixed errorprone version instead of breaking builds (and therefore integration systems)? That would also provide a reproduceable result instead of eventually breaking once a new version of errorprone is released. And if users would want to test a new errorprone version, they still could do that the same way users are now required to pin the version.

It could, but because the release cycle of Error Prone and the gradle-errorprone-plugin are (almost) completely disconnected, that would mean people using the plugin without thinking too much about the Error Prone version could miss updates (and that'd be particularly true once the plugin reaches some maturity – that won't happen until Gradle provides public APIs we can build upon though, rather than relying on Gradle internals, but I'm hopeful ;-) ).
On the other hand, using the latest version as currently, people can run into problems (either this one about Java version, or the build breaking because the newer version of Error Prone enabled/added new patterns) and that should ring a bell that they should "actively" think about the version of Error Prone they're using (but that means monitoring for updates), or knowingly keep using the latest version and possibly facing build breaks.