Using a map in build.gradle throws NoClassDefFoundError: [Ljava/util/HashMap$Entry

Gradle 1.12 with Java 1.8.0_05-b13 completely broke my build. Steps to reproduce: 1. Clone 2. cd gradle-common 3. ./gradlew clean build

19:39:32.311 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 19:39:32.312 [ERROR] [org.gradle.BuildExceptionReporter]

19:39:32.313 [ERROR] [org.gradle.BuildExceptionReporter] * Where: 19:39:32.314 [ERROR] [org.gradle.BuildExceptionReporter] Build file ‘/Users/Abhijit/Repositories/git/build-tools/gradle-common/build.gradle’ line: 13 19:39:32.315 [ERROR] [org.gradle.BuildExceptionReporter]

19:39:32.317 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 19:39:32.318 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project ‘gradle-common’. 19:39:32.319 [ERROR] [org.gradle.BuildExceptionReporter] > [Ljava/util/HashMap$Entry; 19:39:32.325 [ERROR] [org.gradle.BuildExceptionReporter]

19:39:32.325 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 19:39:32.327 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘gradle-common’.

19:39:32.386 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: [Ljava/util/HashMap$Entry; 19:39:32.388 [ERROR] [org.gradle.BuildExceptionReporter] at 19:39:32.389 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ 19:39:32.390 [ERROR] [org.gradle.BuildExceptionReporter] … 53 more 19:39:32.391 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry 19:39:32.391 [ERROR] [org.gradle.BuildExceptionReporter] … 55 more

Gradle 1.12 doesn’t officially support to be executed under Java 1.8. Among other things, it’s based on a Groovy version which doesn’t officially support 1.8. The goal is to have full Java 1.8 support in Gradle 2.0.

This is still a problem with Gradle 2.0. This is a blocker bug.

Cannot reproduce. Please double-check that you are running with Gradle 2.0. For me, your build fails during ‘:sample-client:findbugsMain’, presumably becauseFindBugs 2.0.3 isn’t Java 8 compatible.

100% positive about Gradle 2.0. I’ll follow the instructions as in original post to the letter (assuming that’s what you did) and see if I get a different result.

  1. Confirmed that by following the instructions as above, I can reproduce the issue. 2. Seems like lot of people have the exact same problem, including another thread in this forum. However, no one seems to have any solution. 3. A Groovy bug GROOVY-4950 was opened on this issue 2 years back. Apparently, it was fixed.!topic/gaelyk/w_25LzOlTQ8!topic/google-appengine/SvjJI-h9pso

Abhijits-MacBook-Pro:gradle-common Abhijit$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
  Abhijits-MacBook-Pro:gradle-common Abhijit$ gradle --version
Gradle 2.0
  Build time:
 2014-07-01 07:45:34 UTC
Build number: none
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
        1.8.0_05 (Oracle Corporation 25.5-b02)
         Mac OS X 10.9.3 x86_64

OK, for some reason, my Gradle wrapper was being generated for v 1.10. I updated that manually and now ConfigSluper works. However, I still converted all props[‘key’] to props.key to avoid any hassle. Upgrading FindBugs to 3.0.0 takes care of the issue you mentioned.

So the only problem was that you were using Gradle 1.10?

Yes. I’m not sure how that happened though. I regenerated the wrapper using a 2.0 version and my wrapper version was set to 2.0 as well. Still… I must’ve done something wrong.

I was having the same problem with Gradle 2.0 and JDK 8 when using localGroovy() as a dependency. Switching to ‘org.codehaus.groovy:groovy:2.3.3’ fixed the problem.

I’m not sure if this is a bug or not.