Eclipse not being able to import Gradle Project

Solution 1:

Hmm... it looks like the used groovy implementation cannot handle Java17 classes (major version 61) but uses ASM to decompile (maybe for analysis).

Looking at https://docs.gradle.org/current/userguide/compatibility.html it looks like you need at least gradle version 7.3 to have JDK17 supported.

Looking at your stacktrace I am not sure if the problem is the used gradle version (<7.3) by yourself, or if the problem lies inside the used eclipse plugin.

Problemhandling

Your Gradle version

Just change your gradle version used inside ./gradle/wrapper/gradle-wrapper.properties - or if you do not use a wrapper (which is highly recommended!) you must update your local gradle installation.

Verify

To verify it's working at least from command line you should do

cd ${yourProjectRootPath}
./gradlew build

Check if the build fails here - if so that's a common gradle setup problem and is not related to eclipse plugins.

Eclipse plugin setup

If the problems lies NOT at your own gradle setup (means your gradle version is >=7.3) you should read further:

At the moment there are two gradle IDE implementations on eclipse marketplace available (AFAIK):

  1. Buildship This plugin comes along with eclipse installation and is IMO the most common way nowadays, please look at
    https://github.com/eclipse/buildship/blob/master/docs/user/README.md for more information.

    Buildship uses internally the Gradle API a lot and maybe the stacktrace output came from here. If this is the case you should change to a version >=7.3 inside your eclipse preferences (Main menu: "Window" -> "Preferences" and search for "gradle" )

    When you install the newest eclipse (2021-12) you will normally have automatically support for gradle 7.3 - see next picture:
    Buildship preference screen

  2. Egradle
    When your using EGradle this cannot be a problem of the plugin but MUST be inside your own configuration (Disclaimer: I am the author of the plugin).

The reason is that EGradle just calls gradlew (or gradle) under the hood via command line and does not use the gradle API at all, so you must change your used gradle version inside your code as described before.

egradle preference screen

If you want to use EGradle you must be aware, that you have to setup eclipse tooling inside your gradle build files as described here: https://docs.gradle.org/current/userguide/eclipse_plugin.html

Reason: EGradle lets create eclipse project files etc. by gradle itself.

Documentation about EGradle can be found at https://github.com/de-jcup/egradle/wiki and inside plugin documentation. The plugin is a little bit old but works still with all gradle versions (I use it normally at work and also private).