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

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?

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.

Another option is to:
Move to your projects path (where gradle or gradlew is found)
Unix: sh gradlew cleaneclipse
Win: gradlew cleaneclipse
Requires the apply plugin: 'eclipse' in your build.gradle
Refresh your Project in eclipse.
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.

I seriously searched for the solution, but only found workarounds. Alan47's solution created the file for me, but couldn't create the project properly in my case. So I just copied the file created and imported the project again in the default way:
File -> Import -> General -> Existing Project into Workspace
and pasted the file again at the directory
./.settings
The name of the file:
org.eclipse.buildship.core.prefs
The content of the file is only:
connection.project.dir=
eclipse.preferences.version=1

The easiest solution, using just the mouse
As is told here by oehme (Stefan Oehme - core dev):
https://github.com/eclipse/buildship/issues/504
"Buildship can't recreate that file as it cannot know what your root project was (Gradle supports arbitrary project layouts). You should either check the settings file in or not check in any Eclipse files at all. Checking in .project while leaving out .settings is not supported."
Or here (Stefan Oehme - core dev):
https://discuss.gradle.org/t/do-i-need-to-check-in-settings-org-eclipse-buildship-core-prefs-file/22457/2:
"This would happen if you have a checked in .project file with the buildship nature, but no checked in settings file. The choice is between checking in both or checking in neither and using the Gradle import wizard."
The easiest solution, using just the mouse is the following:
Right click on the project then click Properties
In the properties window go to the Project Natures and remove the Gradle Nature then click Apply and Close button
Open again the same window and add Gradle Nature back, then click Apply and Close button
Right Click on the project > Gradle > Refresh Gradle project
After each step: 1,2,3,4 let eclipse do its update job, do not push it quickly.
Other solution is to have the file saved somewhere and paste it again in the project or create from scratch manually, then do: Right Click on the project > Gradle > Refresh Gradle project.
Useful details:
File name: org.eclipse.buildship.core.prefs
File usual encoding: ISO_8859_1
File path: ./setting/org.eclipse.buildship.core.prefs
File content, one line: connection.project.dir = eclipse.preferences.version=1

maybe you can use this method. by making the file back
I accidentally deleted or lost the file in my flutter project.
then I make a new method
enter the ./android folder in your flutter project.
copy to your terminal for mac:
touch "org.eclipse.buildship.core.prefs"; echo "connection.project.dir=
eclipse.preferences.version=1" >> org.eclipse.buildship.core.prefs
then to your ./android/app folder in your flutter project.
touch "org.eclipse.buildship.core.prefs"; echo "connection.project.dir=..
eclipse.preferences.version=1" >> org.eclipse.buildship.core.prefs

Step 1
Right-click on your project name in IDE > Properties > Project Natures > Choose Gradle Project Nature on the right pane > Remove > Apply and Close
Step 2
Right-click on your project name in IDE > Configure > Add Gradle Nature
Result
Give it a few seconds for Gradle to synchronize with the IDE, and
.settings file will be automatically generated in the project root.
Delete error
Delete the error in Problems view.

Related

MANIFEST.MF (The system cannot find the path specified)

I am trying to create the project as set out in the tutorial "http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/". I have followed all the steps but I get thee POM error ....
Description Resource Path Location Type
C:\Users\xxxxxx\workspace\CrunchifyRESTJerseyExample\target\m2e-wtp\web-resources\META-INF\MANIFEST.MF (The system cannot find the path specified) pom.xml /CrunchifyRESTJerseyExample line 1 Maven Configuration Problem
I've noticed that I have 2 Web Content folders: One under Deployed Resources, which does contain my MANIFEST.MF file and another at the same level as the Deployed Resources folder. Eclipse seems to be looking for it in the second WebContent folder where it is not located. Is there a simple fix for this?
I had similar problem and updating the Maven project solved it.
In Eclipse, right click on the project > Maven > Update Project
See this post:
http://kodurishiva.blogspot.pt/2016/04/manifestmf-system-cannot-find-path.html
This situation returns when I do a maven clean.
Thre are two ways to solve this error.
From Eclipse:
Right-click on the project -> Go to Maven -> Update project.
The second way is from maven clean install using the command line maven.
Use the following command:
mvn clean
Go to Libraries tab in the projects' Build Path. JRE system library must be projects's default JRE.
Thre are two ways to solve this error.
From Eclipse:
Right-click on the project -> Go to Maven -> Update project.
Updating Maven project just resolved my problem
For Eclipse:
Check if your project does not have the folder - src/main/java.
Then right-click on the project -> Click Build Path -> Configure build path -> click on the sources tab in the opened window.
You will not see the error for the src/main/java folder missing.
Select it and remove it. The error will be gone.

Eclipse: "declared package does not match the expected package", but buildpath does define the declared package

In a maven project called my-project, eclipse keeps telling me
The declared package "com.myself" does not match the expected package "main.java.com.myself"
although I verified that in the project's build path, I have an entry:
my-project/src/main/java
Included: **/*.java
Excluded: (None)
Native library location: (None)
Ignore optional compile problems: No
What could be the problem then?
What is the easiest way to fix the problem?
I suspect that something is wrong with the eclipse settings files, because after importing the project to the workspace and converting it to a maven project, I had to change the folder structure manually in to get the conventional folder structure of a maven web project. But it could be that during those changes, something was not understood properly by eclipse.
Also, maven is able to build my project (from within eclipse, as well as from the command line).
I'm just getting those compilation error from eclipse.
P.S. I've already tried project > clean, but it did not help.
Set my-project/src/main/java as the source folder (Project -> Properties -> Java Build Path -> Project -> Add Folder). Remove the old source folder.
Restart eclipse if necessary.
Simply put, Eclipse thinks that your project begins at my-project/src. Therefore, it expects all packages to descend from there, starting with main.java.
Looks like the project is still not in maven nature...
Follow the steps:
Right Click on the project folder -> Maven -> Update Project...
OR, open the command prompt, go to the root project directory, and type the following command:
mvn eclipse:clean eclipse:eclipse
I copied the project folder to some place outside of my eclipse workspace.
Then I deleted the project from the eclipse project explorer and the workspace.
Now I created a new java project with the same name, and imported the original project that I saved at (1).
Tah dah! no compilation errors.

Import maven project in eclipse - folder structure not as expected

I am new to maven projects. Steps followed :
I tried importing a maven project in eclipse through File -> Import.
Gave the location of root dir of the svn checkout project. It recognized the pom.xml file.
Clicked Finish. Project imported and all files were placed in the Project Explorer of the eclipse.
Problem:
The directory structure was not as that of a java package, it was just a normal folder structure. I am not able to browse the code quickly i.e. get the declaration, different calls to a method and all the code browsing shortcuts. It gives a error says.. Project not in Build Path. On right clicking the project, there are no options present in the 'Build Path'.
Please let me know, what I am doing wrong here. How to import a maven project correctly into eclipse and set it up ?
Run :
mvn eclipse:clean
Then
mvn eclipse:eclipse
And it should be it's old self again, if not refresh the project in eclipse and that should do it
I have faced similar issue . I have resolved this issue :
Right click on project -> properties -> Project Facets -> convert it into Facet form
And you can get the folder structure as you want
I faced the same issue and could resolve by following steps
First ensure that you are able to maven clean or install. Just to ensure the proj setup works.
Right click on Project.
Navigate to Maven > Update project configuration.
This should resolve the issue. Hope this helps.
I resolved this issue with:
go to Window > Preferences > build path
under output and source folder choose the project
delete/backup original project and create/import the same.
your issue will be resolved.

Eclipse: Cannot find project in Project Explorer

I am using Eclipse Juno SR1 Java EE, and checked out code from SVN as an Eclipse project. I am able to click on files in the project to verify everything was ok. The next time I rebooted, I can't see the project in the Project Explorer window.
A few things I checked: The menu item Project > Open Project is greyed out, indicating there are no closed projects. The project's file tree exists in my workspace. Eclipse won't let me create a new project with the same name because one already exists.
This is my first time using Juno, is there some new control that hides projects from view?
"File -> Import -> General -> Existing Projects Into Workspace"
"File -> Import -> Android -> Existing Android Code Into Workspace" doesn't do what you're trying to accomplish (been there...).
Assuming the above lines mean what they say, the first tells Eclipse to recognize what you're importing as an official Project. The 2nd tells Eclipse that you're importing only the code, not the Project itself.
Sometimes it's just because .project file is missing. If you have any other project, copy its .project file and paste inside the main folder of the project you're trying to import.
Try starting with the clean option in command line, maybe that should fix it
eclipse -clean
try
file -> switch workspace -> other
and tell eclipse where your workspace is
I was facing the same problem with RAD. What I did was:
imported only those projects which were deployed locally in my portal server.
Did a clean build.
Started the server.
It worked for me. Able to access my application. Rest of the projects which were not deployed as part of my local portal server, I will import them on need basis later.

How to convert IntelliJ project to Eclipse?

I have one IntelliJ project and I want to open it in Eclipse, so what should I do?
There is an export to eclipse option in Intellij Under file menu.
This option will generate you the necessary .project and .classpath files that will be used by eclipse. Personally, I would remove any IDE dependencies using some dependency management systems like Maven or Apache IVY. ( Is system the right term?)
I had the same issue and (I don't have Intellij) but doc_180's comment pointed me in the right direction. Here is a simple solution. In Eclipse create a new blank Android project. Copy the .project and .classpath files and the .settings folder to the Intellij folder. Edit the .project file and change the name of the project.
You should now be able to Import the project in Eclipse by right clicking and selecting "Import->Existing Project into Workspace".
I see this is an old question, but thought I should add this answer for others Googling it like me ;)
Without access to IntelliJ to export and convert the project, try the following.
In STS or Eclipse create an empty project first, then, select File -> Import and choose General -> File System. In the resulting dialog box, select the root folder of the IntelliJ project as source and the empty project as the destination.
For unit tests, add the test folder as a source folder to the build path (right-click on the folder, select Build Path -> Use as Source Folder).
The projects I import this way run without any further modifications, including the tests.
Eclipse and Intellij create different project structure each other (Output path, Source Code etc...). You can export the current project to Eclipse environment.
File -> Export -> Project to Eclipse