How do I reinstall Eclipse without losing my projects and plugins? - eclipse

My Eclipse recently broke completely and I have upgraded to Galileo. I have created a fresh workspace (say foo/workspace) and created a trivial project. I have then copied an old project from (bar/workspace/myproject) to foo/workspace/myproject. It is mavenised and has a pom.xml. How do I tell Eclipse to build it (it does not seem to recognise it is mavenised). Do I have to install the maven plugin?
In general what is the smoothest way to reinstall Eclipse (i.e. what else do I need to think about?)

I never create or checkout a project directly under the Workspace but rather use something like ~/Projects for all my projects. This allows me to remain IDE independent. Actually, I never use any IDE to create a project.
I share my workspace location across several Eclipse install (specified at startup or using -data). If anything goes wrong, I don't mind deleting and loosing my workspace, it doesn't contain anything really important anyway.
Use the m2eclipse Eclipse plugin to Import > Maven Projects into Eclipse. Another option is to use the maven eclipse plugin to generate the .project and .classpath from the command line and then to Import > Existing Projects into Workspace from Eclipse.

It is better to reference directly your old workspace when starting your new eclipse installation: see this eclipse.ini
-data
c:/a/path/to/your/old/workspace
That way, you get back all your projects.
You can install the m2eclipse maven plugin by adding its update site to the list of sites examined by the eclipse p2 provisioning mechanism
http://m2eclipse.sonatype.org/update/

If the metadata associated with your workspace is messed up, and it sounds like it is, the easiest thing to do is simply delete the .metadata folder from the workspace (or rename it to something else). Start up Eclipse, it will show an empty workspace, and then use File -> Import to import existing projects back into your workspace. Just point it to the folder of the existing project and it will do the right thing, leaving the project in place.
For the maven stuff, the Import Maven projects mentioned above seems right and probably does some other stuff to have maven work out.

Related

Permanently fix the Eclipse error "project description file (.project) is missing"

Every time I boot Eclipse I get the error "The project description file (.project) for my project is missing".
As other StackOverflow answers have show, this is easy enough to fix: delete package from Eclipse and import it again. However, if I close and reopen Eclipse the error will be back. I have not found a permanent solution yet.
I have my workspace in my Dropbox, but at some point I decided it was time to start using Git. I don't really get Git but they say you have to put the .project file in your .gitignore because it is computer specific.
This I feel is the origin of the problem, but if I don't do any git related activities (push, commit, etc.) I still get this error.
How do I fix this once and for all?
A .project is a Eclipse-specific file that tells Eclipse about how the project's struture is placed in the project's hierarchy.
It's normal for this file (and other Eclipse specific files) to not be committed because other people participating on the same project may use other IDEs of their choices (intellij, and so on), so the content committed in your VCS is 'neutral' for IDEs.
When you create a project from inside Eclipse, the .project file shall be created along. But when you import into Eclipse an existing project, there are ways to generate locally the .project , .classpath and other Eclipse-required files. Maven, Gradle and Ant are some examples of tools that do this.
Finally, I recommend to keep these files in .gitignore so the project's contents in VCS will remain neutral to IDEs. So you will not bother other people using other IDEs.
So, the steps are:
Check out the project
Generate the eclipse files using maven, ant or gradle. If your project already uses a tool such as these, thats nice
Check if the project is OK inside eclipse (compiling, no errors)
Add the newly generated eclipse files to .gitignore
commit and push the .gitignore.
.project is not machine-specific as long as everyone on your team has the plug-ins installed for that kind of project. .classpath might be if you don't do things right. This is your project, though, so commit your .project.
Keeping .classpath clean largely revolves around keeping machine-specific paths and references out of it:
Set the project's JRE using an Execution Environment. It is an indirect way of saying what version you need, then the IDE figures it out for that machine. The stored value defaults to using the name of your default Installed JRE in the preferences, which is very machine-specific.
Put the jar files you need into the project, or into another project that this one can refer to. They go into source control as well for the sake of repeatability, unless you're using a tool like Maven, in which case be specific about the version you require where ever you state that dependency and make sure the relevant M2E plug-ins are installed.

Make Eclipse reference maven projects and not jars

I'm trying to have the projects within my workspace to reference each other directly, instead of the jar files from the maven repo. That used to work perfectly fine when having all the projects in the same folder (eclipse workspace) and using mvn install and mvn eclipse:eclipse. However, now it's not working and I believe it's due to the fact that the projects are not located in the workspace folder, but in my local GIT repo, from where I import them into Eclipse. I assume that I need to set some variable somewhere, but couldn't find anything on this on the interwebs. I've also tried using the eclipse maven plugin, but I got into other problems that completely broke my setup. Using -Declipse.useProjectReferences=true doesn't help either. I'm grateful for any hint!
I suddenly began having this problem after a reboot (??).
What worked for me was:
on my project's context menu, open "Properties"
Java Build Path tab: add the projects which need to be referenced
Order and Export tab: move these projects to the top of the list
There's a setting on each Project to control this behavior. Right-click to open the project Properties, then select the Maven section; there you'll find the option Resolve dependencies from Workspace projects.

maven integration in eclipse new project checked out but can't navigate

I am struggling with maven in Eclipse even though I have m2e.
I checked out a maven project from CVS and cannot navigate anywhere. If I try References > Project, I get a pop up saying:
"Problems opening an editor Reason: services does not exist".
services is the name of the main project, which has sub projects within it. It all builds successfully so I am not sure why Eclipse does not work.
I suspect something related to classpath but have no idea how to edit it since it is not available from the project's properties. I actually tried to manually create a .classpath file but it did not help.
I also converted the project to a maven project but that did not help either.
Any ideas? I am using Eclipse JUNO.
I figured out my issue. I had to check out the project from CVS. Then (that's the important part), perform a maven import of an existing project within eclipse. That created maven "ready" projects where I could use all of the IDE's functionality.
Yes, you're right. If you import directly from a repository, hovering, linking and opening declarations isn't gonna work. Your solution is right, although another one more direct is use the "File->New->Other->Maven->Checkout Maven Projects from SCM". If then, you have problems because you can't select any SCM type, check Checkout Maven project from SCM - no connectors. If with connectors installed you still have problems: http://forum.springsource.org/showthread.php?102665-SCM-types-not-available-in-Checkout-Maven-Projects-from-SCM.
If you have checked out project from svn, project checked out is not generally a eclipse project thats why general functionality of eclipse does not work for the same.
To achieve the same functionality of eclipse like eclipse reader and all other shortcuts,we have to convert the checked out project to eclipse project.
Steps to Convert checked out project to eclipse project:
Right Click on Checked-out Project.
Point to Configure.
Click on Convert to Maven Project.(if checked out project is maven project)
These steps will convert the project to Maven project.
All the eclipse functionality will work for the same.
In addition to ensuring that the projects are configured as Maven projects, you may also go to Project Properties (right-click on the project in Package explorer) > Project References, and add projects in the workspace that the selected project may have references to.
I had this problem, too.
It looks like after a search-in-workspace Eclipse opened a wrong file.
I pressed Strl+Shift+H (Open Type in Hierarchy), typed in the class name, and opened it. The file opened in a new tab, and everything was navigable again.
The difference in icons is:

eclipse -restore missing projects

For some unknown reason the projects that I created in a workspace are no longer listed in the package explorer tab. The actual files of the programs still exist on the flash drive which was the designated workspace. How do I correct this problem so that I can access the projects in this workspace?
Are you in a different workspace? Try File > Switch Workspace or if you are in the right workspace already, you could try File > Import > General > Existing Projects into Workspace and re-import the projects.
Create new project on the menu, then select the button "Create project from existing source" and select your project directory on disk.
If you are working with Android projects, the straight import does not work. The fastest way I've found to deal with this issue is to move (not copy) the projects to a different location, then import them back into the workspace, making sure copying the files into the original workspace.
At this time, the Android eclipse plugin has a bug in it which will rename your projects to the package names, rather than using the "friendly" names you intended for the projects. Since eclipse quite often seems to drop projects in this way, this can lead to a great deal of frustration. If this bug is fixed, or you know of a workaround, I would appreciate hearing about it.
I had a case where my project disappeared from the workspace and when I tried to import the existing project into workspace, Eclipse reported the project was already in the workspace! So I simply created a new project with the same name/location as the folder in which the project was located. This brought the project back to life in my worskpace. This worked in Kepler version of Eclipse.
I found a way to resolve this issue without creating a new project.
My projects disappeared from the Package Explorer view when I was in the Java EE perspective. When I switched to the Java perspective, they reappeared in Package Explorer.
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600
Not sure what caused this issue out of the blue and how long this solution will hold.
A simple solution that requires deleting the affected projects from your workspace, then importing them again:
Delete the affected projects from your workspace (do not delete from disk)
Open the files. File >> Open Project from File System >> Select location of files >> Select projects to open.
After you import them, it should work.
Try a refresh (F5) of the workspace.

pydev and the src directory vs. scm

I'm trying to transition to eclipse+pydev but am having a problem importing projects under scm. My old projects (and also projects on github) don't have the "src" parent directory that pydev seems to really like.
If I use egit or subclipse to import/check out the project, the pydev environment is incomplete. If I externally check out the source and move it into place, I don't seem to be able to tell eclipse it's SCM'd.
I would think this is a FAQ, but I can't figure it out. What is the best practice to use SCM'd projects under eclipse that aren't SCM'd as eclipse projects.
Thanks. Kent
Choose the properties for the project. Then change the pydev-PYTHONPATH - remove the src entry and then add the directory of your project that contains the source.