eclipse stuck when building workspace

EclipseBuildWindows Vista

Eclipse Problem Overview


I am using eclipse 3.4.1 Java EE under Vista. It seems to like getting stuck when building my workspace. Canceling the build doesn't seem to do anything as well.

Why is this happening and how do I fix the problem?

Eclipse Solutions


Solution 1 - Eclipse

I was able to fix this with the following:

First, exit Eclipse. Then temporarily move the following .projects folder to a safe location:

mv .metadata\.plugins\org.eclipse.core.resources\.projects projects

Start and exit Eclipse, then move the .projects folder back to where it was originally:

mv projects .metadata\.plugins\org.eclipse.core.resources\.projects

Use at your own risk, of course.

Solution 2 - Eclipse

Some time it's very helpful to execute eclipse from command line with "-clean" parameter to enforce it produce clean up for workspace.

Solution 3 - Eclipse

eclipse -clean did not work but following did

eclipse -clean -clearPersistedState

Solution 4 - Eclipse

Eclipse often freezes for me at 44% if I'm debugging Android over USB. When disconnecting the device, Eclipse starts.

Solution 5 - Eclipse

The accepted answer allowed me to get Eclipse started again, but it seems that the projects lost their metadata. (E.g., all the Git/Gradle/Spring icons disappeared from the project names.) I have a lot of projects in there, and I didn't want to have to import them all over again.

So here's what worked for me under Kepler. YMMV but I wanted to record this just in case it helps somebody.

Step 1. Temporarily move the .projects file out of the way:

$ cd .metadata/.plugins/org.eclipse.core.resources
$ mv .projects .projects.bak

Step 2. Then start Eclipse. The metadata will be missing, but at least Eclipse starts without getting stuck.

Step 3. Close Eclipse.

Step 4. Revert the .projects.bak file to its original name:

$ mv .projects.bak .projects

Step 5. Restart Eclipse. It may build some stuff, but this time it should get through. (At least it did for me.)

Solution 6 - Eclipse

Step1:

Open project directory and edit .project file, remove following lines to disable java script validation.

  <buildCommand>
      <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
      <arguments>
      </arguments>
    </buildCommand>

Save file.

Step 2:

Go to Eclipse installed directory and open eclipse.ini(or sts.in if you have STS), change xms and xmx value based on your RAM size of your computer.

-Xms512m
-Xmx1024m
-XX:MaxPermSize=256m

OR: in windows, go to eclipse shortcut in desktop, right click->properties-> add following: C:\software\eclipse\sts-3.6.2.RELEASE\STS.exe -clean -Xms512m -Xmx1024m

Run Eclipse.

Go to Eclipse->windows->preference->Validation, enable Suspend all validators. Do this if you don't want do any validation listed in the list given in Validator panel.

Solution 7 - Eclipse

You may want to take a look at How to report a deadlock. You may also want to check the Error view and/or the error log ([workspace]/.metadata/.log). If that doesn't help, you'll probably need to include more info about which plugins you have installed and which projects you have. Can you create a minimal workspace which reproduces the problem?

Solution 8 - Eclipse

I have this problem whe I have too much maven projects open at once. What I tend to do is:

  • Restart eclipse (sometimes I need to kill eclipse)
  • Disable automatic build immediatly (project > uncheck Build automatically)
  • Right click the project(s) I want to have rebuild
  • Close unrelated projects
  • Re-enable automatic build

This enables a functioning rebuild in 99% off the cases in my workspace.

Solution 9 - Eclipse

I faced Similar issue in Eclipse Indigo. I changed the HeapSize it started working correctly. I just added following eclipse.ini file -vmargs -Xms1024m -Xmx1024m

It worked fine after increasing the VM size

Solution 10 - Eclipse

The only solution for me (Luna 4.4.1) was this:

Go to Project Properties > Builders and then uncheck the Javascript Validator.

Solution 11 - Eclipse

I had same issue with my Eclipse and as a solution, I created new project, copied all resources manually (using windows copy/paste) to new project, deleted old project and that's it.

Sometimes, this happens due to improper System shutdown and Eclipse workspace started facing similar issues.

Hope it will work.

Solution 12 - Eclipse

Unselect automatic build using Eclipse-> Windows->Preferences helps fixing this issue.

Solution 13 - Eclipse

Deleting some of the JDT indexes (in .metadata.plugins\org.eclipse.jdt.core), particularly the big files, often fix or ease the problem for me.

Solution 14 - Eclipse

I just had the same problem.

By using Task Manager to kill the build process and exiting Eclipse with no projects open, I was able to get back into Eclipse and clean the project without opening it. I then restarted Eclipse again,loaded my project and all OK.

Solution 15 - Eclipse

I've found that this might also happen if you rebuild a workspace with a project containing a lot of image data (such as a dedicated images project). Might be best to put something like that into its own workspace and handle it separately to the rest of the projects you deal with.

If you can't, then don't clean that project when you clean and rebuild. Only rebuild when necessary.

Solution 16 - Eclipse

In my case problem arise after importing downloaded project - stuck at 80% build. Solved by adding write permissions for group to project's files (Ubuntu 12.04).

Solution 17 - Eclipse

In my case it helped to remove the source folders from my favorites in the Windows Explorer (Windows 8.0). It seems that the build was not actually stuck, but triggered in some kind of infinite loop (as mentioned here - Bug 342931).

Solution 18 - Eclipse

Sometimes the problem seems to be fixed by killing other programs which have files open from the project folder.

Solution 19 - Eclipse

Looking at the logs in [workspace]/.metadata/.log provided useful information for me. Turned out there was a java.lang.OutOfMemoryError: PermGen space error when the workspace build would hang. This can be edited in the eclipse.ini or sts.ini(If you are using SpringSource Tool Suite) file.

Solution 20 - Eclipse

I faced the same problem when I tried to install Angular.js with bower in my project. I seems bower has lots of javascript files it downloaded automatically which caused my IDE to stuck in validation process for a long time. So, I solved this problem this way,

  • I first installed tern.js 0.9.0.
  • Then I went to the project properties, selected tern script path included only the path I needed for validation, My project's javascript folder. I excluded other path like placeholders, Angular.js files, Jquery files.
  • I selected the Javascript from the properties again and did the same things in include path's source.

My IDE currently working without freezing. I took help from there. Tern I guess it can be helpful, where any IDE stuck due to lots of Javascript file.

Solution 21 - Eclipse

I tried lots of these suggestions, but the only thing that finally worked for me was creating a new workspace, and freshly checking out all my projects into that folder. Then it worked fine ;-)

Solution 22 - Eclipse

I just restarted eclipse and it started working the next time.

Solution 23 - Eclipse

Refresh all the projects u want to build. Worked

Solution 24 - Eclipse

Restart eclipse.
It worked for me several times.

Solution 25 - Eclipse

I was able to solve this by removing extra folder that Eclipse had created in my eclipse installation folder. I didn't install and I was using Eclilpse Neon 3 with Spring Tool suite also installed. But, when I looked into extracted eclipse installation, I had C: folder which had some folder structure. It was mirror image of my Downloads folder. I removed it and restarted.

It worked for me!

Solution 26 - Eclipse

None of the the answers here worked for me. What worked was to delete the following folder

> C:\Users\your username\workspace\project > name.metadata.plugins\org.eclipse.core.resources.projects\project > name\.indexes

Solution 27 - Eclipse

Rather than debug and find the exact root cause(s) for this, I just deleted the projects and the metadata folder. Eclipse will rebuild the .metadata file the next time it's launched.

I then pulled in the latest project code and the problem was solved. It was more work as I had to reconfigure everything, including my servers, but build workspace had been stopping at 50% for anywhere from 3 to 5 minutes before it would completely finish, so it was worth the effort.

Also, I've found that with Eclipse, if you stop the build workspace before it completes and shut down Eclipse if that hangs up everything, you can really mess up your configuration and waste lots of time trying to get it stable again. I'm using Eclipse Oxygen, but I've had this happen in all the versions of Eclipse I've used, so I really try to avoid it, if possible.

Solution 28 - Eclipse

Inside the project folder open .project file. There is a bad entry and it might help

    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>

Solution 29 - Eclipse

If you are using Maven as a build tool you might want to:

  1. Close eclipse

  2. Delete dependency directories located in .m2/repository/ - in Linux it's located under Home directory and in Windows it should be in c:\Users<YourUsername>.m2 (replace '' with your username)

  3. Start Eclipse and enjoy normal work :)

That helped me resolve this issue and I hope it helps you too. :)
Cheers!

P.S. I've edited my answer (as @howlger asked) where it was also suggested to delete .eclipse and .p2 folders as it can do harm (although it did NOT in my case + I had to reinstall some of plugins I'm using).

Solution 30 - Eclipse

In case there is a problem on start when building your project disable the build automatically from menu. Project -> Build Automatically. This solved my problem while more sophisticated solutions could not.

Solution 31 - Eclipse

This can also happen if you have an empty java file that is named and classpath-located exactly like another java file (which can happen when resolving merge conflicts for moved resources).


For example, the following setup causes this issue in a multi-maven module:

  • module1/src/main/java/com/package/MyClass.java (empty)
  • module2/src/main/java/com/package/MyClass.java (actual valid class)

To fix, simply delete the empty java file.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionseanView Question on Stackoverflow
Solution 1 - EclipseJames BeningerView Answer on Stackoverflow
Solution 2 - EclipseArtem BargerView Answer on Stackoverflow
Solution 3 - Eclipseuser2574678View Answer on Stackoverflow
Solution 4 - EclipseTerje LundinView Answer on Stackoverflow
Solution 5 - Eclipseuser41871View Answer on Stackoverflow
Solution 6 - EclipseAKBView Answer on Stackoverflow
Solution 7 - EclipseJesperEView Answer on Stackoverflow
Solution 8 - EclipsePieter De BieView Answer on Stackoverflow
Solution 9 - EclipseAnjan DashView Answer on Stackoverflow
Solution 10 - EclipsedxvargasView Answer on Stackoverflow
Solution 11 - EclipseQamarZView Answer on Stackoverflow
Solution 12 - EclipseKrisView Answer on Stackoverflow
Solution 13 - EclipseFlávio EtruscoView Answer on Stackoverflow
Solution 14 - EclipseSimpleSiView Answer on Stackoverflow
Solution 15 - EclipseOcracokeView Answer on Stackoverflow
Solution 16 - EclipseAlexKView Answer on Stackoverflow
Solution 17 - EclipsemartinView Answer on Stackoverflow
Solution 18 - EclipseTim KuipersView Answer on Stackoverflow
Solution 19 - Eclipsemjj1409View Answer on Stackoverflow
Solution 20 - EclipseMahinView Answer on Stackoverflow
Solution 21 - EclipseBrad ParksView Answer on Stackoverflow
Solution 22 - EclipseRajanView Answer on Stackoverflow
Solution 23 - EclipseRohan GalaView Answer on Stackoverflow
Solution 24 - EclipseneelrotnoView Answer on Stackoverflow
Solution 25 - EclipsePiyush PatelView Answer on Stackoverflow
Solution 26 - Eclipse124697View Answer on Stackoverflow
Solution 27 - EclipseJames DrinkardView Answer on Stackoverflow
Solution 28 - EclipseMichaelKView Answer on Stackoverflow
Solution 29 - EclipseNikolaSView Answer on Stackoverflow
Solution 30 - EclipsevicangelView Answer on Stackoverflow
Solution 31 - EclipseAntoine MeyerView Answer on Stackoverflow