Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Missing Gradle project configuration file" issue in Buildship?

As an Eclipse user, I always liked the Gradle IDE. However, this plugin is now deprecated in favor of the new Buildship plugin.

After setting up a fresh Eclipse IDE with Buildship installed, I'm faced with the following error in all my Gradle projects:

missing gradle project configuration file: .settings/org.eclipse.buildship.core.prefs

There are several pages on google that deal with this issue, but all of them seem pretty outdated. There is also an entry in the bugtracker of the plugin which is set to "CLOSED FIXED". Well, apparently, it's not fixed.

Am I doing something wrong? Any ideas how to tackle this issue?

like image 821
Alan47 Avatar asked Feb 22 '17 13:02

Alan47


People also ask

How do I create a Gradle config file?

In Eclipse, select File > Export. In the window that appears, open Android and select Generate Gradle build files. Select the project you want to export for Android Studio and click Finish.

What is Gradle Buildship?

Buildship is an Eclipse plugin that allows you to build applications and libraries using Gradle through your IDE.

How do I run Gradle project in STS 4?

Go to the New project wizard (Ctrl-N) of STS Eclipse and create a Gradle project. On the Gradle Projec t wizard , assign a name for your project and choose Java Quickstart for the Sample project option. Click Finish and it will take a while to create, build, clean, and install your Gradle STS project.


2 Answers

I've figured it out myself. The issue with the "missing gradle project configuration file" arises from the way the gradle project(s) are imported into Eclipse.

When importing a gradle project via the regular File -> Import -> General -> Existing Project into Workspace command, then it will not work and produce the aforementioned error.

However, if you import the very same project via File -> Import -> Gradle -> Existing Gradle Project, then you get a different import wizard, and with this wizard, it works like a charm.

I still think it's a bug because the choice of the import wizard should not matter. Still, choosing the proper wizard is a viable workaround.

like image 124
Alan47 Avatar answered Sep 18 '22 12:09

Alan47


Another option is to:

  1. Move to your projects path (where gradle or gradlew is found)
  2. Unix: sh gradlew cleaneclipse Win: gradlew cleaneclipse

Requires the apply plugin: 'eclipse' in your build.gradle

  1. Refresh your Project in eclipse.
  2. After that for Unix: sh gradlew eclipse Win: gradlew eclipse

Now the gradle nature will be missing in your eclipse-project. Open the context menu of your project -> configure -> add gradle nature

Now everything should be fine again.

like image 39
SWiggels Avatar answered Sep 20 '22 12:09

SWiggels