Opening project files in eclipse - java

I am unable to open certain project files in eclipse. The error message says that the Project Description file(.project) is missing. However if I open up the folder using windows explorer, I am able to see the .project file. I am not sure how to resolve this, hope someone can advise. Thank you.

Try to import manually the project in the workspace by doing:
File -> Import -> General -> Existing Projects.
Then select the root directory of your project.
After that it should be configured correctly

Related

How can I open this Spring project in Eclipse?

Silly question, cant seem to get it to work.
https://spring.io/guides/gs/rest-service/ mentions a Java project - available here on GIT - https://github.com/spring-guides/gs-rest-service.git and here directly - https://github.com/spring-guides/gs-rest-service/archive/master.zip .
When I try to import the zip, it fails. I tried to unzip and import selecting the root folder at source and it won't work.
How can I open this project in Eclipse and make my own changes?
Thanks.
Ensure that you are selecting "Existing Maven Project"
File > Import > Maven > Existing Maven Project
Point to the inflated directory and choose the pom.xmls
With Eclipse Neon, File > Open Projects from Filesystem... , select Archive and give location of your zip, click Finish.

import project from workspace in eclipse

I have problem with importing projects from workspace into eclipse even though I am able to check the projects (which shows checkable).
After I hit the finish button, there is an error which says
"Some projects can not be imported because they already exist in the workspace or their project description file is corrupt."
I have already deleted the projects from workspace so that let me be able to check from the import box.
So I guess that "project description file is corrupt" is the cause.
Can you help me out to fix it. I will appreciate it in advance.
I would suggest start from scratch ,including choosing new location for Workspace.
If all of your old projects exist in a single directory or in a single parent directory, you can do File -> Import... -> Existing Projects into workspace. Choose a root directory that is a parent all of the projects you want to import. You will then be able to import project/projects at once.
Change your workspace it will work fine.
The below issue solved my issue:
Navigate to your workspace.
Copy the existing project you want to import somewhere else.
Now import the existing project in the eclipse.
It should look like below image after copying

How to import a spring project in STS

Just by a mistake I had deleted a spring project in STS.To use it back I borrowed the same project from my friend in zip format but when I tried to import it says
Some projects cannot be imported because they already exist in the workspace
Following is the way I tried to import
file->import->general->existing projects into worspace->select archive file
and after browse when I select the zip project
Some projects cannot be imported because they already exist in the workspace
and the finish button and next button are in disabled state.Please help me
The workspace in STS/Eclipse is not automatically the same as the file structure that you have on disc in your workspace directory. You can have projects in this workspace folder or somewhere else on disc.
To get them into your project explorer (and access them from inside STS/Eclipse), you need to import them (Import Existing Projects into Workspace). Then you can select the folder where those projects are located in. In case you have those projects already in your workspace folder on disc, you can choose the workspace folder as root folder in the wizard. It will show all the projects that exist on disc in that folder and grey those out that are already imported/referenced in your workspace in Eclipse.
Make sure it is really not in workspace, also if there aren't any other projects with the same name. If not, just delete the .metadata folder or create a new workspace.
Check if you still have the project in folder of the workspace on disk. You may have deleted in STS, without checking 'Delete on disk'. So, the project may be still there in the workspace folder though its deleted in STS.
I get this issue from time to time. Usually I just open a new workspace but sounds like you don't want to loose other projects.
I simply open the.project file in my project and change the name of the project in name tag.
Good Luck!
Probably whey you 'accidentally deleted' your project, you only deleted it from the Eclipse workspace, but not from the actual workspace folder on your hard-drive (as other people pointed out, Eclipse can arbitrarily map workspace projects to files on disk, so it is possible for a project to be 'deleted' from your Eclipse workspace but still exist on disk.
The good news is the files you deleted are actually still there.
Instead of importing your project from a zip, you may just want to import those files from the workspace folder back into your Eclipse workspace.
Generally this kind of problems not occurred you can go to Project option and clean and than restart STS.
May be STS is not synched with the latest configured project.
When you launch Spring Tools Suite, it will ask you to Select directory as workspace as below:
If the directory you selected here (i.e., workspace directory) is the same as the directory where the project that you are going to import resides, then you will get Some projects cannot be imported because they already exist in the workspace.
Therefore, to solve the issue,
Close Spring Tool Suite
Create a new directory
Launch Spring Tool Suite again
And, select that as your workspace
Launch the application and you would be able to import as you mentioned in your question
It solved my problem.
Hope it helps..
Happy Coding!!
the problem is that when you delete a project maybe sts only close it.
Try View Menu --> uncheck closed projects
Now you will see all closed project, simply delete it.

Messages cannot be resolved error when imported Jenkins plugin as Maven project

I am new to plugin development for Jenkins. I have imported Jenkins plugin as maven project, i am using Luna Eclipse with jdk1.7 and Maven3.0.
The imported project i have build 'mvn using clean install' and it build successfully, but still I get error which says Messages cannot be resolved.
I tried cleaning, building, refreshing the project, change of work-space, also tried,
click this folder in the package explorer and add it from the context menu by following Build Path > Use as Source Folder as suggested form Jenkins https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+plugin+development+with+Eclipse
but still I have the same issue. Although this does't give any error while building the project, it appears as error on folders. How do I overcome this , any help is appreciated. Thanks in advance.
I got the answer to this, its very easy.
If you see your Eclipse reporting that the "Messages" classes do not exist, make sure Eclipse is treating your target/generated-sources/localizer directory as one of the source root directory. If not, click this folder in the package explorer and add it from the context menu by following "Build Path > Use as Source Folder"
Lets try to translate this to English,
Search for folder called genarated-source in your imported folder in your Eclipse.
you will find it under : ex- jenkins-ci------>traget---->generated-sources---->localizer
Right click on localizer select "Build Path > Use as Source Folder"
where jenkins-ci is the main folder which you imported into your eclipse.

Can you import a non-archive project directory in Eclipse?

I read this article which shows how to import/export projects in Eclipse (although it seems a little outdated and I'm using 3.7 Indigo).
To export a project, you go to File >> Export and it creates some kind of "project archive" file on the local file system. You could then email it to someone else, who could then import the archive as a new project or into an existing project.
But what if you don't have an "archive" file to begin with?!? What if you just have the project files and directories but without all the Eclipse-metatdata (.project file, etc.)? Is there anyway to tell Eclipse to look at, say:
/home/myuser/some/path/to/project/root/
src/main/java
SomeObject.java
build.xml
...and get it to read that as a new Java project?
Try the steps below:
Create a Java Project in Eclipse as below:
Load the project contents from your file system as below:
Hope this works for you.
.project and .classpath files are the base of the project structure. Without a .project file Eclipse won't recognize your project. The .classpath is important too but that one changes between environments. Should you use the files from another environment you'll have to reconfigure some settings.
Rather than emailing code, I suggest you use a Version Control system and, also, some Eclipse plugins. SVN + Subclipse for example.
If you trully want to send the project to another person just send him the project's folder and import it as an existing project by doing right click on the project explorer and selecting Import > Existing Project into workspace.

Categories